This is for google custom search api.
Project description
How to use this package.
first please install this package
pip install google-custom-search
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.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c8d80bb3c4a3998dfc5b9ff3d3346a475917c1c22d7ea11a81153b9d1406e0 |
|
MD5 | b1128909df00490efb11019d658fe46a |
|
BLAKE2b-256 | 3974c11b27a1997e75e69e55472f8867674ed57231362690e8f74fc42ee99392 |
Close
Hashes for google_custom_search-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b39dd8e332eb54c17ebf68bed630f41cbc4c0cd4ea364bad9f7ed8e7ba77fbdd |
|
MD5 | 3bec4639a25c22b4d198defae1886f5f |
|
BLAKE2b-256 | 3ab9577ab9943f67362a5a944e77971cb9ff14cc895d2734afb3cc19cbd5b10d |