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():
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)
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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc1bf10b7e3269252c2bf2226a97160a5da6fe8ebd87639b15037aac611a252 |
|
MD5 | ed266f6882ab2bd968c57e482e901370 |
|
BLAKE2b-256 | 810f711ebba56d91fee85b725c405f80e4135ddea1008ed2a872d2cacf45d08f |
Close
Hashes for google_custom_search-2.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0bc7e349ecb5723d4da568105b6ca97aedc077c8e9e8fe68775d27140ce0154 |
|
MD5 | b060f09b83a3046cd8136cd39a6c0fdf |
|
BLAKE2b-256 | 49a6c6c49d1e15ac707db0c6176f740f41ba6892907479b0766410742f5b3b83 |