Use the Google Custom Search API from Python.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
sample_data Checked in sample data Dec 6, 2013
.gitignore Add gitignore Dec 6, 2013
LICENCE Added LICENCE Dec 5, 2013 Added a limitations section to README Dec 6, 2013 Add link to documentation for Google Custom Search May 15, 2014 Add Dec 6, 2013

Use the Google Custom Search API to search the web from Python.

This is by no means a finished library!

Quick start

from google_search import GoogleCustomSearch

SEARCH_ENGINE_ID = os.environ['SEARCH_ENGINE_ID']                           

api = GoogleCustomSearch(SEARCH_ENGINE_ID, API_KEY)

for result in'pdf', ''):

See these instructions (although the process wasn't completely the same):

1. Make a Google Custom Search Engine

2. Make a Google Cloud Console "Project" to get API key

  • Provides an API key - explained in the developer docs at

  • You need to enable access to Custom Search service

  • Allows separating billing for different projects, using the same custom search engine.

  • To view your quota, go to "APIs & auth" => "APIs" => "Custom Search API" => "Quota" at the top.

When you make a Cloud Project, you need to enable the "Custom Search API" feature.

To get an API key, go to "APIs & Auth" => Registered apps => Register New App => Web Application => Server Key


If you try and search across more than 10 sites (including "the whole web") you'll get results from a limited subset of the Google Index:

"""If your custom search engine includes more than ten sites, the results may be from a subset of our index and may differ from the results of a 'site:' search on"""