From: John Runyon Date: Sun, 3 Mar 2024 01:56:45 +0000 (-0700) Subject: urls - fix big exception if AIA encounters an SSL error X-Git-Url: https://jfr.im/git/erebus.git/commitdiff_plain/c5db60257c131dcdd1b97ea74a168317c3bb64ce urls - fix big exception if AIA encounters an SSL error --- diff --git a/modules/urls.py b/modules/urls.py index 98e2bf0..fd21676 100644 --- a/modules/urls.py +++ b/modules/urls.py @@ -264,7 +264,10 @@ def _do_request(url, try_aia=False): except ValueError: return '', False if try_aia: - opener = urllib2.build_opener(urllib2.HTTPSHandler(context=aia_session.ssl_context_from_url(url)), SmartRedirectHandler()) + try: + opener = urllib2.build_opener(urllib2.HTTPSHandler(context=aia_session.ssl_context_from_url(url)), SmartRedirectHandler()) + except aia.AIAError as e: + return 'Request error: %s.%s: %s' % (e.__module__, e.__class__.__name__, e.args[0]), True else: opener = urllib2.build_opener(SmartRedirectHandler())