disable_certificate_validation not being properly set on AdWordsClient
@msaniscalchi đang làm issue này rồi.
Từ ngày 5/6/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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?
- Ngôn ngữ chính
- Python
- Star
- 749
- Fork
- 967
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleads/googleads-python-lib
-
[Bug] Potential Billion Laughs Attack Vector via Unrestricted XML Parsing in `ZeepSchemaHelper` Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Create Native Creative - Issue Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
image-package Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
Tất cả issue của googleads/googleads-python-lib
Issue tương tự
-
bug confirmed issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
open-webui/open-webui#30750 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100