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.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)
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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f040cfe23c3e057b5b4e758a944b7a93280b38ccbd7ec69623177918b97b2f |
|
MD5 | a03234eeefde72649905d78df5db4507 |
|
BLAKE2b-256 | 079bc93582fc758435af7529a5e30221c7a777a29f8302775548b2d3e36c0cda |
Close
Hashes for google_custom_search-2.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e8725202e49a330e09f67cdc28844ad9893aa1fc26ad7bac24c0acb416578b3 |
|
MD5 | c6c1c2f4a704b8c12d24d196fdef8f1b |
|
BLAKE2b-256 | 174e7cca4f1d014728baf99ffbf72d3e703451e57e46498795f3c00927e64249 |