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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleads/googleads-python-lib のほかの issue
-
[Bug] Potential Billion Laughs Attack Vector via Unrestricted XML Parsing in `ZeepSchemaHelper` オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
image-package オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
googleads/googleads-python-lib の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
UKGovernmentBEIS/inspect_evals#2523 ·