zoukankan      html  css  js  c++  java
  • set up custom search api

    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__ = 'jcgregorio@google.com (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 <http://code.google.com/apis/console>
    # to get an 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()

  • 相关阅读:
    java多线程-阻塞队列BlockingQueue
    java多线程-ThreadLocal
    JZ-C-26
    JZ-C-25
    JZ-C-24
    JZ-C-23
    JZ-C-22
    JZ-C-21
    JZ-C-20
    JZ-C-19
  • 原文地址:https://www.cnblogs.com/wintor12/p/3960286.html
Copyright © 2011-2022 走看看