Skip to content

Commit

Permalink
fix: handles URL exception or SSL verifications errors for both pytho…
Browse files Browse the repository at this point in the history
…n 3.8 and 3.11 inclusive (#231)
  • Loading branch information
pabloitu authored Jun 6, 2023
1 parent 97ba99e commit c6d028f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion csep/utils/comcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ def _search(**newargs):

except URLError as URLe:
# Fails to verify SSL certificate, when there is a hostname mismatch
if isinstance(URLe.reason, ssl.SSLCertVerificationError) and URLe.reason.verify_code == 62:
if (isinstance(URLe.reason, ssl.SSLCertVerificationError) and URLe.reason.verify_code == 62) \
or (isinstance(URLe.reason, ssl.SSLError) and URLe.reason.errno == 5):
try:
context = ssl._create_unverified_context()
fh = request.urlopen(url, timeout=TIMEOUT, context=context)
Expand Down

0 comments on commit c6d028f

Please sign in to comment.