Set up custom Search API

Source: Internet
Author: User
Tags pprint

Sign up Google Developer console, create project, generate API key

http://stackoverflow.com/questions/4082966/google-web-search-api-deprecated-what-now/11206266#11206266

Example Code:cx is custom search engine key, developer key is API key

"" "Simple command-line example for Custom Search.

Command-Line application that does a search.
"""

__author__ = ' [email protected] (Joe Gregorio) '

Import Pprint

From Apiclient.discovery Import Build


def main ():
# Build A service object for interacting with the API. Visit
# The Google APIs Console # to get a API key for your own application.
Service = Build ("Customsearch", "V1",
developerkey= "Aizasyawk-vgppyoaktoexv-xedtleoibffrvlu")

res = SERVICE.CSE (). List (
Q= ' chemical spill West Virginia ',
cx= ' 008308517875943079687:j1fqrkb1_yi ',
). Execute ()
Pprint.pprint (RES)

if __name__ = = ' __main__ ':
Main ()

Set up custom Search API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.