Proxy

如要透過 Proxy 連線至 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 指定為 Proxy。此外,您可以使用 GoogleAdsClient 方法 load_from_dictload_from_envload_from_string,以程式輔助方式設定 Proxy 設定,方法跟任何其他配置設定一樣。例如:

config = {
  ...
  "http_proxy": "INSERT_PROXY_HERE",
}
googleads_client = GoogleAdsClient.load_from_dict(config)

如要搭配 load_from_env 方法使用 Proxy,請設定 GOOGLE_ADS_HTTP_PROXY 環境變數。