Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Client library for the Google Ads API

Project description

This project hosts the Python client library for the Google Ads API.

Features

  • Distributed via PyPI.
  • Easy management of credentials.
  • Easy creation of Google Ads API service clients.

Requirements

  • Python 2.7.13+ / 3.5.3+
  • pip

Getting started

Installation

This library is distributed via PyPI. If you have not already done so, install pip, the following command to install this client library:

pip install google-ads

Configuration file setup

To authenticate your API calls, you must specify your client ID, client secret, refresh token, and developer token. If you have not yet created a client ID, see the Authorization guide and the authentication samples to get started. Likewise, see Obtain your developer token if you do not yet have one.

When initializing a GoogleAdsClient instance via the load_from_storage class method, the default behavior is to load a configuration file named google-ads.yaml located in your home directory. Included in this repository is a template you can use.

Create a GoogleAdsClient

You can run the following to retrieve a GoogleAdsClient instance using a configuration file named google-ads.yaml stored in your home directory:

client = google.ads.google_ads.client.GoogleAdsClient.load_from_storage()

Get types and service clients

You can use a GoogleAdsClient instance to retrieve any type or service used by the API. To retrieve a type such as a CampaignOperation, provide its name to the get_type method:

campaign_operation = client.get_type('CampaignOperation')

Likewise, you can provide the name of a service to get_service in order to retrieve the corresponding service client instance:

google_ads_service = client.get_service('GoogleAdsService')

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
google-ads-0.2.0.tar.gz (223.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page