If you need to connect to the Google Ads API through a proxy, you can do so by setting
the http_proxy
config in your
google-ads.yaml
file:
# Proxy configuration
###############################################################################
# Below you can specify an optional proxy configuration to be used by #
# requests. If you don't have username and password, just specify host and #
# port. #
# #############################################################################
http_proxy: INSERT_PROXY_HERE
For example, you can specify http://user:pass@localhost:8082
as a proxy.
Alternatively, you can configure the proxy setting programmatically using the
GoogleAdsClient
methods: load_from_dict
, load_from_env
, and
load_from_string
, just like any other configuration setting. For example:
config = {
...
"http_proxy": "INSERT_PROXY_HERE",
}
googleads_client = GoogleAdsClient.load_from_dict(config)
To use a proxy with the load_from_env
method, set the GOOGLE_ADS_HTTP_PROXY
environment variable.