Skip to main content

This is for google custom search api.

Project description

google-custom-search

Downloads Downloads Downloads Documentation Status

Install

pip install google-custom-search

or if you want use async/await, please install.

pip install google-custom-search[async]

Sample code

import google_custom_search

google = google_custom_search.CustomSearch(apikey="your api_key", engine_id="your engine_id")
# if image is True, it's can search, but you need to setting at google console search

results = google.search("Hello")

for result in results:
    # get a title.
    print(result.title)
  
    # get a link.
    print(result.url)
  
    # get a displayLink.
    print(result.display_url)

    # get a htmlTitle.
    print(result.html_title)
  
    # get a snippet.
    print(result.snippet)

Sample code async version

import asyncio
import google_custom_search

google = google_custom_search.CustomSearch(token="your api_key", engine_id="your engine_id", image=True)
# if image is True, it's can search, but you need to setting at google console search

async def main():
    results = await google.search_async("word!")
    for result in results:
        # get a title.
        print(result.title)
  
        # get a link.
        print(result.url)
  
        # get a displayLink.
        print(result.display_url)

        # get a htmlTitle.
        print(result.html_title)
  
        # get a snippet.
        print(result.snippet)
    
asyncio.run(main())

or

import asyncio
import google_custom_search

google = google_custom_search.CustomSearch(token="your api_key", engine_id="your engine_id", image=True)
# if image is True, it's can search, but you need to setting at google console search

async def main():
    async for item in google.search_async_iterator("word!"):
        # get a title.
        print(item.title)
  
        # get a link.
        print(item.url)
  
        # get a displayLink.
        print(item.display_url)

        # get a htmlTitle.
        print(item.html_title)
  
        # get a snippet.
        print(item.snippet)
    
asyncio.run(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-3.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_custom_search-3.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file google_custom_search-3.0.0.tar.gz.

File metadata

  • Download URL: google_custom_search-3.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for google_custom_search-3.0.0.tar.gz
Algorithm Hash digest
SHA256 8ea8876327a0ae45a60b243af71a49297691454b25a2c71cb89a090351d544b3
MD5 376c58f600bd03dcfd3c2048ae86ee82
BLAKE2b-256 67890730f98e0e8ceecce83be82d5316a0223f6974b06f0f613bd71ea9216fca

See more details on using hashes here.

File details

Details for the file google_custom_search-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_custom_search-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 968e1c32e94f0ec7781e8e51c77b569d21d828af2089c7293d18d3976f408708
MD5 325a796fb53ac8e036628e2bc512a8be
BLAKE2b-256 ae04210941b513c3580b4f1df6f5368e95a81dd08ec493826d888bb6e9fa6f97

See more details on using hashes here.

Supported by

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