אם אתם צריכים להתחבר ל-Google Ads API דרך שרת proxy, תוכלו לעשות זאת על ידי הגדרת הקובץ http_proxy
בקובץ google-ads.yaml
:
# 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.
לחלופין, אפשר להגדיר את הגדרת שרת ה-proxy באופן פרוגרמטי באמצעות השיטות של GoogleAdsClient
: load_from_dict
, load_from_env
ו-load_from_string
, בדיוק כמו כל הגדרת תצורה אחרת. לדוגמה:
config = {
...
"http_proxy": "INSERT_PROXY_HERE",
}
googleads_client = GoogleAdsClient.load_from_dict(config)
כדי להשתמש בשרת proxy בשיטה load_from_env
, מגדירים את משתנה הסביבה GOOGLE_ADS_HTTP_PROXY
.