AI-generated Key Takeaways
-
You can connect to the Google Ads API through a proxy by setting the
http_proxyconfiguration in yourgoogle-ads.yamlfile. -
The
http_proxysetting ingoogle-ads.yamlsupports specifying a proxy with or without username and password. -
Alternatively, you can configure the proxy setting programmatically using
GoogleAdsClientmethods likeload_from_dict,load_from_env, andload_from_string. -
To use a proxy with the
load_from_envmethod, set theGOOGLE_ADS_HTTP_PROXYenvironment variable.
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.