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
result = google.search("Hello")
# get a list of title.
for title in result.titles:
print(title)
# get a list of link.
for url in result.urls:
print(url)
# get a list of displayLink.
for i in result.display_urls:
print(i)
# get a list of htmlTitle.
for i in result.html_titles:
print(i)
# get a list of snippet.
for i in result.snippets:
print(i)
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 i in result.titles:
print(i)
for i in result.urls:
print(i)
for i in result.display_urls:
print(i)
for i in result.html_titles:
print(i)
for i in result.snippets:
print(i)
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-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31314da11a832565b085261c52003dc71d1a1a9d5d3db6e110de2d1cc31dc8d5 |
|
MD5 | 1b14a76f41bab883b4e5127467cf2ade |
|
BLAKE2b-256 | b6b237c3df60639db70cd20216b26f7e7c4a8640ed4f5a58f98bc12aa7cd5024 |
Close
Hashes for google_custom_search-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91e9d3120d851cf521ba68a53cc84dbdb626835defb715d274bb79522d505f7 |
|
MD5 | c9e61566a86167f699821a8df2d91bc7 |
|
BLAKE2b-256 | 40d252f08347985cf4bbbd70e6690ef90fa84448951fbac8049eb9893b392758 |