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.5a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a5bdbd79fe0da04fedd2419793fdbbb50b55979854d3801a14c3cd0054f8d74 |
|
MD5 | 3d49ed6ab159a35454c24b3a51033f5a |
|
BLAKE2b-256 | 81a05eb57e2743be672c2fec56efe6b38997abfff44ea01c9be56365681bd449 |
Close
Hashes for google_custom_search-2.0.5a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a19a525c934951fc5c1ed2efdffd9a551bbdd30060ac0fd49e14d8e71cd1a92d |
|
MD5 | 65dc0bc98bbe60d8860f88e0ba078ce7 |
|
BLAKE2b-256 | d3b80fb0554d12245ea8863ad0cf90d0766f17e6f4b070c5f2b7e55af3f2ac60 |