如果您需要通过代理连接到 Google Ads API,可以在 google-ads.yaml 文件中设置 http_proxy 配置:
# 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
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-27。"],[[["\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."]]