1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-24 22:06:14 +01:00

Fix connection to work on python 3.6

Use ssl.CertificateError instead of ssl.SSLCertVerificationError.
This commit is contained in:
Daniel Mach 2022-08-30 11:41:09 +02:00
parent d9cb3c58ed
commit 5a9909370d

View File

@ -296,8 +296,9 @@ def http_request(method, url, headers=None, data=None, file=None):
if not isinstance(e.reason, urllib3.exceptions.SSLError):
# re-raise exceptions that are not related to SSL
raise
if isinstance(e.reason.args[0], ssl.SSLCertVerificationError):
# ssl.SSLCertVerificationError doesn't exist on python 3.6
# ssl.CertificateError is an alias for ssl.SSLCertVerificationError on python 3.7+
if isinstance(e.reason.args[0], ssl.CertificateError):
self_signed_verify_codes = (
oscssl.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
oscssl.X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN,