หากต้องการเชื่อมต่อกับ Google Ads API ผ่านพร็อกซี ให้ตั้งค่าhttp_proxy
config ในไฟล์ 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