disable_certificate_validation not being properly set on AdWordsClient
@msaniscalchi 已经在做这个了。
开始于 2024年6月5日。
评估
这个 Issue 还没有评估数据。
描述
I'm trying to use Charles proxy to monitor comunication between my script and the Google Adwords api.
I created a ProxyConfig object like this:
proxy_config = ProxyConfig(
http_proxy='127.0.0.1:8888',
https_proxy='127.0.0.1:8888',
disable_certificate_validation=True
)
I disabled the certificate validation because Charles proxy uses a self signed certificate to monitor the https requests.
Then, I instantiate a oauth2 client and an adwords client like this:
oauth2_client = GoogleRefreshTokenClient(
client_id,
client_secret,
refresh_token,
proxy_config=proxy_config
)
self.client = AdWordsClient(
developer_token,
oauth2_client,
client_customer_id=self.customer_id,
proxy_config=proxy_config
)
When I make the calls to the Adwords api I can see that the refresh token is properly generated and monitored by Charles. However, the AdWordsClient calls fail with the error:
Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain)
Digging the code, I found out that the proxies defined in proxy_config are used on the Zeep client instantiated in
googleads.common._ZeepProxyTransport:
class _ZeepProxyTransport(zeep.transports.Transport):
"""A Zeep transport which configures caching, proxy support, and timeouts."""
def __init__(self, timeout, proxy_config, cache):
"""Initializes _ZeepProxyTransport.
Args:
timeout: An integer timeout in MS for connections.
proxy_config: A ProxyConfig instance representing proxy settings.
cache: A zeep.cache.Base instance representing a cache strategy to employ.
"""
if not cache:
cache = zeep.cache.SqliteCache()
elif cache == ZeepServiceProxy.NO_CACHE:
cache = None
super(_ZeepProxyTransport, self).__init__(
timeout=timeout, operation_timeout=timeout, cache=cache)
self.session.proxies = proxy_config.proxies # HERE THE PROXIES ARE USED
However the parameter disable_certificate_validation is never used! I think this can be solved by adding the following line just below:
self.session.verify = not proxy_config.disable_certificate_validation
At least this works for me.
Is this really a bug? Or is there a different way of configuring the "disable_certificate_validation" parameter that i'm missing?
- 主要语言
- Python
- 星标
- 749
- 派生
- 967
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleads/googleads-python-lib 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
image-package 未关闭
难度 5/5 一周以上 新手友好度 10/100
-
难度 1/5 1 小时以内 新手友好度 1/100
查看 googleads/googleads-python-lib 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100