This is for google custom search api.
Project description
google-custom-search
How to use this package.
Next version can search image.
first please install this package
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.custom_search(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.custom_search(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():
result = 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)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for google-custom-search-2.0.0a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60145836fdeb5813b610d0e9e065d2992a19bc5495cf31a461051272f13e9a43 |
|
MD5 | 34f6746dd7334cee2fbfd656661574bd |
|
BLAKE2b-256 | d379b533eee737974339e1b840934e6c324be6b504fa0d40a47477b426051391 |
Close
Hashes for google_custom_search-2.0.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7706424945faceccfd974755b3e936c30e0e87297668208f1e2322a5ba0d21c |
|
MD5 | 4f67fb1cfc6f3cc03d093138014d9d80 |
|
BLAKE2b-256 | 521c5dd61d3866b178a6f205dd982e008ef3f56ee130509e6e651270ec71fed2 |