Handle URL connection errors
This happens in test_urls.py
.
We don't want a huge trace when there are connection issues.
_______________________ test_urls[opensuse42.3] _________________
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:715: in urlopen
httplib_response = self._make_request(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:404: in _make_request
self._validate_conn(conn)
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1056: in _validate_conn
conn.connect()
/usr/lib/python3/dist-packages/urllib3/connection.py:419: in connect
self.sock = ssl_wrap_socket(
/usr/lib/python3/dist-packages/urllib3/util/ssl_.py:449: in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
/usr/lib/python3/dist-packages/urllib3/util/ssl_.py:493: in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
/usr/lib/python3.11/ssl.py:517: in wrap_socket
return self.sslsocket_class._create(
/usr/lib/python3.11/ssl.py:1108: in _create
self.do_handshake()
/usr/lib/python3.11/ssl.py:1379: in do_handshake
self._sslobj.do_handshake()
E ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)
During handling of the above exception, another exception occurred:
/usr/lib/python3/dist-packages/requests/adapters.py:486: in send
resp = conn.urlopen(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:827: in urlopen
return self.urlopen(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:827: in urlopen
return self.urlopen(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:827: in urlopen
return self.urlopen(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:799: in urlopen
retries = retries.increment(
/usr/lib/python3/dist-packages/urllib3/util/retry.py:592: in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='repo.ugm.ac.id', port=443): Max retries exceeded with url: /opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)')))
During handling of the above exception, another exception occurred:
tests/test_urls.py:194: in test_urls
ok = _check_url(session, url, url_type)
tests/test_urls.py:104: in _check_url
response = session.head(url, allow_redirects=True, headers=headers, timeout=30)
/usr/lib/python3/dist-packages/requests/sessions.py:624: in head
return self.request("HEAD", url, **kwargs)
/usr/lib/python3/dist-packages/requests/sessions.py:589: in request
resp = self.send(prep, **send_kwargs)
/usr/lib/python3/dist-packages/requests/sessions.py:725: in send
history = [resp for resp in gen]
/usr/lib/python3/dist-packages/requests/sessions.py:725: in <listcomp>
history = [resp for resp in gen]
/usr/lib/python3/dist-packages/requests/sessions.py:266: in resolve_redirects
resp = self.send(
/usr/lib/python3/dist-packages/requests/sessions.py:703: in send
r = adapter.send(request, **kwargs)
/usr/lib/python3/dist-packages/requests/adapters.py:517: in send
raise SSLError(e, request=request)
E requests.exceptions.SSLError: HTTPSConnectionPool(host='repo.ugm.ac.id', port=443): Max retries exceeded with url: /opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)')))
--------------------------- Captured log call ----------------------------
WARNING urllib3.connectionpool:connectionpool.py:824 Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)'))': /opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso
WARNING urllib3.connectionpool:connectionpool.py:824 Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)'))': /opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso
WARNING urllib3.connectionpool:connectionpool.py:824 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1006)'))': /opensuse/distribution/leap/42.3/iso/openSUSE-Leap-42.3-DVD-x86_64.iso