This is for google custom search api.
Project description
google-custom-search
Install
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)
asyncio.run(main())
or
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():
async for item in google.search_async_iterator("word!"):
# get a title.
print(item.title)
# get a link.
print(item.url)
# get a displayLink.
print(item.display_url)
# get a htmlTitle.
print(item.html_title)
# get a snippet.
print(item.snippet)
asyncio.run(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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_custom_search-3.0.0.tar.gz.
File metadata
- Download URL: google_custom_search-3.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ea8876327a0ae45a60b243af71a49297691454b25a2c71cb89a090351d544b3
|
|
| MD5 |
376c58f600bd03dcfd3c2048ae86ee82
|
|
| BLAKE2b-256 |
67890730f98e0e8ceecce83be82d5316a0223f6974b06f0f613bd71ea9216fca
|
File details
Details for the file google_custom_search-3.0.0-py3-none-any.whl.
File metadata
- Download URL: google_custom_search-3.0.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
968e1c32e94f0ec7781e8e51c77b569d21d828af2089c7293d18d3976f408708
|
|
| MD5 |
325a796fb53ac8e036628e2bc512a8be
|
|
| BLAKE2b-256 |
ae04210941b513c3580b4f1df6f5368e95a81dd08ec493826d888bb6e9fa6f97
|