Skip to main content

An asynchronous Google Search Engine API wrapper

Project description

cse.py

Asyncio API wrapper for the Google Custom Search JSON API.

Installation

PIP

pip install -U cse.py

GIT

pip3 install -U git+https://github.com/Hype3808/cse.py

Usage

import cse

client = cse.Engine("Your API Key") # create the Search client (uses Google by default!)

results = await client.search("Python", safesearch=False) # returns a list of cse.Result objects

print(results[0].title, results[0].description, results[0].url, results[0].image_url) # Title, snippet, URL, and Image URL

await client.close() # Run this when cleaning up.

Getting image results

import cse

client = cse.Engine("Your API Key") # create the Search client (uses Google by default!)

results = await client.search("Python", safesearch=False, image_search=True) # returns a list of cse.Result objects

print(results[0].title, results[0].description, results[0].url, results[0].image_url) # Title, snippet, URL, and Image URL

await client.close() # Run this when cleaning up.

To use Search objects with a custom search engine, provide the ID of the search engine.

cse.Engine("Your API Key", engine_id="015786823554162166929:mywctwj8es4")

SafeSearch can also be turned off by setting safesearch=False when using the search() method.

Getting an API key

You can get an API key by going here and scrolling down to the API key section.

Get API key

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cse.py-1.1.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

cse.py-1.1.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file cse.py-1.1.3.tar.gz.

File metadata

  • Download URL: cse.py-1.1.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for cse.py-1.1.3.tar.gz
Algorithm Hash digest
SHA256 c9f467e39ed82cef635a1eee2f88079494fe7b981fd16b437e8ced38d7c70efd
MD5 c42ae485bca100a65fdd8dbe98fb26be
BLAKE2b-256 01bddf72fdba3f25afbcf0a25c7ab5319921427cb54f1c94ceec1db365b0cee9

See more details on using hashes here.

File details

Details for the file cse.py-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: cse.py-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for cse.py-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 35fe3e8e6e398e490cf5de3a3f37c97146063394e649a1d94e3d32745f738fe9
MD5 8645e872c4d561d0ae5e34507d0b156e
BLAKE2b-256 9a3f2ab6de19494dcf5f6be213d3e4338748b25a3d5d0bdeef25bfe0193000a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page