Skip to main content

This is for google custom search api.

Project description

How to use this package.

first please install this package

pip install google-custom-search

sample code

import google_custom_search

google=google_custom_search.custom_search(token="your api_key", engine_id="your engine_id")

result=google.search("Hello")

# get a list of title.
for title in result.titles:
  print(title)

# get a list of link.
for url in result.urls:
  print(url)

# get a list of displayLink.
for i in result.display_urls:
  print(i)

# get a list of htmlTitle.
for i in result.html_titles:
  print(i)

# get a list of snippet.
for i in result.snippets:py
  print(i)

sample code async version

import asyncio
import google_custom_search

google=google_custom_search.custom_search(token="your api_key", engine_id="your engine_id")

async def main():
  result=await google.search_async("word!")
  for i in result.titles:
    print(i)
  for i in result.urls:
    print(i)
  for i in result.display_urls:
    print(i)
  for i in result.html_titles:
    print(i)
  for i in result.snippets:
    print(i)

loop = asyncio.get_event_loop() 
loop.run_until_complete(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google-custom-search-0.0.4a1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

google_custom_search-0.0.4a1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page