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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12fdcee76fea6f526eecf05031e929597622a180a7c894f03541f84c6cec243a |
|
MD5 | ed26d6dd0d87033639040713654451a0 |
|
BLAKE2b-256 | 3121443f10a02e48088e81bf886bad95933a380106d967d5de0a63a3f30d677f |
Close
Hashes for google_custom_search-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d67fe61c498eb0b80dbe55620be6d248795f3ff297d8d81d1b9d24740b5e7463 |
|
MD5 | 761a396bf52ed53d9d000c0b7edf56d6 |
|
BLAKE2b-256 | f146fe8bf598b4d72247fe71f15d074861a8b8a967ab180e4414c110b94fe4bc |