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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa3291f2490fe90f2750404b3a585bb18cea31514b2dbfb2f55954fd81e25e66 |
|
MD5 | a896a9a207215a79cfefc70113d1861d |
|
BLAKE2b-256 | 772ab0ac1943749fb8dbc3472e5250e88febd45b9d158df6f4e77baf3d8c59d9 |
Close
Hashes for google_custom_search-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ffc0d628560ab3f80b08e0a7bac88f548bd13bbf03b792e7e527ebaa27692c9 |
|
MD5 | f7e48e154e1b8e9bbcbb8b7616635dcc |
|
BLAKE2b-256 | 6c6345e05ea83cc04dbc4bce349112d570e189c7be8fb28729011c8bc2c84b68 |