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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ade15e55755e8a24765fa2513d0816c8d5e225f876b602686fcb73db832c277 |
|
MD5 | afc3efa002402ec2b6f81594636e4f29 |
|
BLAKE2b-256 | 364692123eb3904e3f82591576ca4cbfe4d132d5f54e4b541666149a573c172f |
Close
Hashes for google_custom_search-2.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b5820a328094049e06c314af55d44695e5ce471b2c8ff0b1309481bc014948e |
|
MD5 | 761e648f785fbbdc60f4e27f53498fab |
|
BLAKE2b-256 | 256845cbd39e291f761482b7b01bea5a9ed30fde2e4c8e1eb370d33b4fd1a931 |