หากต้องการเชื่อมต่อกับ Google Ads API ผ่านพร็อกซี คุณสามารถทำได้โดยการตั้งค่า
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
เป็นพร็อกซีได้
หรือจะกำหนดค่าพร็อกซีแบบเป็นโปรแกรมโดยใช้เมธอด
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