Google APIs Client Library for Python

Easily access Google APIs from Python

The Google APIs Client Library for Python provides access to many Google APIs. It is designed for Python client-application developers and offers a way to access APIs that is simple, flexible, and powerful. See the navigation sidebar for a list of guides, references, and other information.

Logo for APIs

Making it simple to call Google APIs

Use the simple and clean library to make calls from Python to an API.

# List my public Google+ activities.
result = service.activities().list(userId='me', collection='public').execute()
tasks = result.get('items', [])
for task in tasks:
  print task['title']
Combination lock

Easy authentication

The easy-to-use authentication library can reduce the amount of code you need to write to handle OAuth 2.0. Sometimes as little as a couple of lines is all you need.

# Authorize server-to-server interactions from Google Compute Engine.
from oauth2client import gce

credentials = gce.AppAssertionCredentials(
  scope='https://www.googleapis.com/auth/devstorage.read_write')
http = credentials.authorize(httplib2.Http())
Google App Engine Logo

Runs on Google App Engine

App Engine-specific helpers make quick work of authenticated calls to APIs. No need to worry about exchanging code for tokens; get right down to writing the meat of your application.

# Restrict access to users that have granted access to Calendar information.
decorator = appengine.OAuth2DecoratorFromClientSecrets(
  'client_secrets.json',
  scope='https://www.googleapis.com/auth/calendar')

class MainHandler(webapp.RequestHandler):
  @decorator.oauth_required
  def get(self):
    http = decorator.http()
    request = service.events().list(calendarId='primary')
    ...
File download

Client library installation

Install the library using standard Python tools.

$ pip install --upgrade google-api-python-client

There are also custom installs optimized for Google App Engine.

Use the Quickstart guide to download a starter application for the API and platform you're interested in:


Check out all the installation options.


Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.