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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5442b714d10fe18fa1081c452b4c9b336215baffbe7b8d622e3c20973746d8f0 |
|
MD5 | eebc4c8c773de5971caef1488d0ea720 |
|
BLAKE2b-256 | 946f29443c1089d473a92a641eaa994df567bc4679ebc7f20af7848693ec2005 |
Close
Hashes for google_custom_search-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7268831f4895b5e6d7defc6717d2a8a6c54b5e08e3f5dcdef06aa16ee81c6aa |
|
MD5 | 6b76042d71f8f30059396a1e5ea4b420 |
|
BLAKE2b-256 | 60a8e8fed84a8c831d7edf2a0cc131879fa70af39d18e644331ba2afce2e72da |