Hide

Sample Applications

This page lists sources and information for sample scripts that demonstrate use of this library.

Before diving into these samples, you should see the Getting Started page. It has basic examples covering API keys, OAuth 2.0, web applications, and installed applications. These scripts are thoroughly commented to explain every step.

The Google APIs Client Library for Python is an open source project on Google Project Hosting. The library source code and many sample applications can be found there. Follow the instructions on the Installation page to install these samples. The samples cover various application types, library features, platforms, and specific APIs.

See the following page for a description of all available samples:
     Sample Applications page

Running samples

Many of the samples use a client_secrets.json file described in the flow_from_clientsecrets() section of the OAuth 2.0 page. Before running a sample script, you need to update this file.

When running a command-line or Google App Engine script locally:

  1. Open the Credentials page.
  2. Under OAuth, click Create New Client ID.
  3. Select Installed Application and Other and click Create Client ID.
  4. Copy the client ID and client secret values under Client ID for native application and paste into the client_id and client_secret fields in the downloaded client_secrets.json file.

When running a script as a web application or deployed Google App Engine script:

  1. Open the Credentials page.
  2. Under OAuth, click Create New Client ID.
  3. Select Web application and click Create Client ID.
  4. Copy the client ID and client secret values under Client ID for web application and paste into the client_id and client_secret fields in the downloaded client_secrets.json file.