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.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fac880dac5df21404049eff1fe0fd7210cab3a62b64cfff13b181baf6e5b1a7 |
|
MD5 | 7e33451ac9598509c06de58087f7ccd6 |
|
BLAKE2b-256 | 39fd172921a55fa0c9302fc410302c1559c12725bde4caf39654ab3324fbd1d3 |
Close
Hashes for google_custom_search-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f5bbfa0236abfa7077a330652aee037e30108022b28a59e68347bba479cf9cd |
|
MD5 | 0dacb488dffa1e6a9de1f9b2e76b1657 |
|
BLAKE2b-256 | 0a98660249cde37609685557e60ba082b3877e864d8a985c244e332a7d142d5d |