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.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b25aebbeba9cbf9e52344709ba3b489d84779ecbcd43bd1897a9f154e09f4cc0 |
|
MD5 | 7c89d4813397fc895c6e2657716abeb8 |
|
BLAKE2b-256 | 1878984d03d1c53b4106f66b4e1fdcd36d42732ebb3113cc629ab535f2c54969 |
Close
Hashes for google_custom_search-2.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36053179dbb3819a8804befb541c5717d1a1bf4c7661c9d1ca5dd475aca8271 |
|
MD5 | 3efd2245f486f0f2d80feec56393dcc0 |
|
BLAKE2b-256 | ec388bba181da576bf5ecfc90a5d3a92782a81d28efd0b030deeacdaf951ee89 |