אם אתם צריכים להתחבר ל-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
.