プロキシ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
プロキシ経由で 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
たとえば、http://user:pass@localhost:8082
をプロキシとして指定できます。また、他の設定と同様に、GoogleAdsClient
メソッド(load_from_dict
、load_from_env
、load_from_string
)を使用して、プロキシ設定をプログラムで構成することもできます。次に例を示します。
config = {
...
"http_proxy": "INSERT_PROXY_HERE",
}
googleads_client = GoogleAdsClient.load_from_dict(config)
load_from_env
メソッドでプロキシを使用するには、GOOGLE_ADS_HTTP_PROXY
環境変数を設定します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-27 UTC。
[null,null,["最終更新日 2025-08-27 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."]]