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
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.1.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7610a21b18bfcb4184072c819e43b165ad9409557621e0f20b52c9e2b314048b |
|
MD5 | d3a9f3c4597a8e26ca00417563baac43 |
|
BLAKE2b-256 | ed000ff40fb342e338a93d41cef2ea7ea1a0079cf025eee294d654241f37c6d0 |
Close
Hashes for google_custom_search-0.1.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 668acf80297f3baef1737612dc2ee7e7aa55ce0fe6a487e403defc6c59e0e138 |
|
MD5 | 4a409167d1ef731fc1b4a8454c9cfdee |
|
BLAKE2b-256 | e572562f51e33c94bfccccacda357882ed1f12ef8997152300ccf9f89b059e62 |