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.0a3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03db677948930931f5cce736306d9e821477f2b8d478aea1ecf252131a2092a7 |
|
MD5 | 3df8cf461091af949c3d4d315c42f91b |
|
BLAKE2b-256 | 855669bb2ea822d3d7201ded6b6b5acf136cb834029191b7a768ad9565ceb4a0 |
Close
Hashes for google_custom_search-2.0.0a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41f457b08653bfb39de5d3e2859565a59d3041a83913cbd5c5d97d10d97bca02 |
|
MD5 | e64801a194bcab23cd80defe8c216f1a |
|
BLAKE2b-256 | b377ea50323c58c257b7281308007a7913f8d12ee5e7e7dbac4f1864165a7828 |