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(token="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.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb245daac46bee40f37068ec9253200a8da8933481059c205fc298e9726e404d |
|
MD5 | d453fe6c8a2d531f042b1ebe2662a6cd |
|
BLAKE2b-256 | fe35a7185265a22cc034ed4d33d48882dcedb68c41e13398589e6de9dee2675a |
Close
Hashes for google_custom_search-0.0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b8d54469afdbce9d9a5e167f5e70cb5c933e3b2fec149ad20af45495c90235b |
|
MD5 | 4ac569eddb52b31d1d64bdd01da205ea |
|
BLAKE2b-256 | 1ae1fbb1a0a55894c5f1a078ea2b5bf2da71414ff04bdbe926fa226f388760cb |