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:py
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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f90f161549bb16cbc690d2511685c7030cf4c9c54cfb2d30f4e16bcb10e40b4 |
|
MD5 | 8800bb65a530c6cd351e7f4a0b7db7a6 |
|
BLAKE2b-256 | 46aa5734f0c20d87d57f2df15637363adf29b019c5be573a1f77d2227199bbb7 |
Close
Hashes for google_custom_search-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 943876c62e780c1c61ee47ad657b7b247be9b9792a493d92e2e8709bfab6be65 |
|
MD5 | 0dc9d9f5940f70ff4a8b9efdc80800d0 |
|
BLAKE2b-256 | 77eb778b0d0b4966734fa2ddd738305e24835e494186f7fdd699569cba599431 |