Install the Python client library
To install the Python client library in your local environment:
- Extract the Python client library tarball.
Run the following command in the same directory:
python -m pip install .
Follow the prompts in the terminal to complete the installation.
Configuration using YAML file
You can specify a YAML file to use when initializing the client that contains
the necessary authentication information needed to make requests. This file is
accessed when a client is initialized using the load_from_file
method.
Follow the example provided below when creating the YAML file
to specify the refresh
token, client
ID, and client secret.
To specify the location where the search-ads-360.yaml
file is located, you can
pass the path as a string to the method when calling it:
from util_searchads360 import SearchAds360Client
client = SearchAds360Client.load_from_file("path/to/search-ads-360.yaml")
If you don't provide a path, the library looks in your $HOME
directory for
the file:
from util_searchads360 import SearchAds360Client
client = SearchAds360Client.load_from_file()
Configuration Fields
The client library configuration supports the following fields.
General fields:
refresh_token
: Your OAuth refresh token.client_id
: Your OAuth client ID.client_secret
: Your OAuth client secret.login_customer_id
: See the login-customer-id documentation.
Supported keys for desktop and web application flows
If you are using the desktop or web application flow, the supported keys are as follows:
# Credential for accessing Google's OAuth servers.
# Provided by console.cloud.google.com.
client_id: INSERT_CLIENT_ID_HERE
# Credential for accessing Google's OAuth servers.
# Provided by console.cloud.google.com.
client_secret: INSERT_CLIENT_SECRET_HERE
# Renewable OAuth credential associated with 1 or more Search Ads accounts.
refresh_token: INSERT_REFRESH_TOKEN_HERE
# Required for manager accounts only: Specify the login customer ID used to
# authenticate API calls. This will be the customer ID of the authenticated
# manager account. You can also specify this later in code if your application
# uses multiple manager account + OAuth pairs.
#
# login_customer_id: INSERT_LOGIN_CUSTOMER_ID_HERE