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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdacda777e212f1072b08ea57bc1dbe12a18e1a37998cf9ec8eda85d6218a753 |
|
MD5 | 6e3354ebb2e513afaeaa6d3b4446b6cb |
|
BLAKE2b-256 | 17184288fd3e2bc8d9dd994739ebb39638f8b9c1a892e96d690083ca95b2e927 |
Close
Hashes for google_custom_search-2.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53f07fbef0a116a0875e4eaa2d01b4fd6885c3409e96b6c63094aa07503bb14e |
|
MD5 | a2170f1536b2b06983056a37fdef9364 |
|
BLAKE2b-256 | 88bdd95628a6abb7e4a04da60af8fc3ea5bf5abaef572ded2ca0e419639261fa |