Proxy
Stay organized with collections
Save and categorize content based on your preferences.
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eConnect to the Google Ads API through a proxy by setting the \u003ccode\u003ehttp_proxy\u003c/code\u003e configuration in your \u003ccode\u003egoogle-ads.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eAlternatively, configure the proxy programmatically using \u003ccode\u003eGoogleAdsClient\u003c/code\u003e methods like \u003ccode\u003eload_from_dict\u003c/code\u003e, accepting a dictionary with an \u003ccode\u003ehttp_proxy\u003c/code\u003e key.\u003c/p\u003e\n"],["\u003cp\u003eTo use a proxy with the \u003ccode\u003eload_from_env\u003c/code\u003e method, set the \u003ccode\u003eGOOGLE_ADS_HTTP_PROXY\u003c/code\u003e environment variable.\u003c/p\u003e\n"]]],[],null,["# Proxy\n\nIf you need to connect to the Google Ads API through a proxy, you can do so by setting\nthe `http_proxy` config in your\n[`google-ads.yaml`](https://github.com/googleads/google-ads-python/blob/HEAD/google-ads.yaml)\nfile: \n\n # Proxy configuration\n ###############################################################################\n # Below you can specify an optional proxy configuration to be used by #\n # requests. If you don't have username and password, just specify host and #\n # port. #\n # #############################################################################\n http_proxy: INSERT_PROXY_HERE\n\nFor example, you can specify `http://user:pass@localhost:8082` as a proxy.\nAlternatively, you can configure the proxy setting programmatically using the\n`GoogleAdsClient` methods: `load_from_dict`, `load_from_env`, and\n`load_from_string`, just like any other configuration setting. For example: \n\n config = {\n ...\n \"http_proxy\": \"INSERT_PROXY_HERE\",\n }\n googleads_client = GoogleAdsClient.load_from_dict(config)\n\nTo use a proxy with the `load_from_env` method, set the `GOOGLE_ADS_HTTP_PROXY`\nenvironment variable."]]