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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a7be1006947e64b2ab2e9f11c6de9ee210d1cd005930c809adf884f3fc2d2e |
|
MD5 | fe014a8735104a61d4454ce0f23b634c |
|
BLAKE2b-256 | de63652d45e441d8de2f629595b81e89272e357e6b1f2cfa1437941f7d58b06f |
Close
Hashes for google_custom_search-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 910fce0ff63d55e200585e32589ff91f31a3e8c42a7a0e0bbb9bccb1aaa8c752 |
|
MD5 | 9ac645a05f4fb62902c05e2027b11f00 |
|
BLAKE2b-256 | 9d4c5b0ed829cc6f5e36a3b7b2d1ba4c6d3c2ee2bbb5604704f454f808eca62a |