Overview

  • The Python client library is available on GitHub and PyPI, requiring Python 3.8 or later.

  • Before installation, you need a developer token and client customer ID.

  • The library maintains compatibility with supported Python runtimes and Google-maintained dependencies.

  • After installation, configure the library and generate OAuth2 tokens for authentication.

  • You can test your setup by making an API request, like the get_campaigns.py example.

The Python client library is hosted on GitHub, and the package is available on PyPI.

Requirements

The library requires Python 3.9 or later.

Prerequisites

Before proceeding with this guide, you will need a developer token for the Google Ads API, and the 10-digit client customer ID for your Google Ads account.

Runtime and dependency compatibility

The Python client library maintains compatibility with the Python runtimes in the Supported Versions section published by the Python Software Foundation, except for versions with a status of "feature" or "prerelease".

We aim to adopt new versions of the Python runtime as soon as they are released and officially supported by the Python Software Foundation.

Python runtimes that have reached end of life (EOL) are not supported past the EOL date in the Unsupported Versions section of python.org. We cannot guarantee compatibility with EOL runtimes, as we may release a version of the library that is incompatible with them at any point after their EOL date.

For dependencies, (specifically, any Google-maintained packages that are listed as required by the Python client library), we will maintain compatibility with packages that are Google-maintained, and considered "supported" according to Google's OSS Breaking Change Policy.

For a complete list of supported Python runtimes and dependencies, see the Dependencies page.

Installation

Our installation guide shows all of the different ways to install the library. The simplest (and recommended) way to install the library into your application is with pip:

$ python -m pip install google-ads

Configuration

Once you have installed the library you will need to set up a configuration for it. There are multiple ways to configure the library, which are described in our configuration guide.

Authentication

Once you've chosen a configuration approach, you can set up your authentication configuration. For step-by-step instructions see our Python client library authentication guide guide, and for more general background see our OAuth overview.

Make an API request

Once you've set up your authentication configuration, you're ready to make an API request. Refer to the get campaigns example for a quick way to test that the library is properly configured to make API requests.

To run the get_campaigns.py sample, in the root directory of your locally installed googleads-python client library, run the following command:

$ python examples/basic_operations/get_campaigns.py -c INSERT_YOUR_CUSTOMER_ID_HERE

Additional resources

After you're able to make an API request, proceed to these uses of the client library: