4 ms·
Kennethreitz requests lib? Just use requests.exceptions.RequestException, that should handle every error, if not then report it. For python urllib IOError and
by nitely 10y ago
Kennethreitz requests lib? Just use requests.exceptions.RequestException, that should handle every error, if not then report it.
For python urllib IOError and OSError should suffice. At least in py3.
- multipass 10y agoand in Python >=3.3, IOError is an alias for OSError.
- jwilk 10y agoimport urllib.request try: urllib.request.urlopen('https://wrong.host.badssl.com/') except (IOError, OSError): pass causes: ssl.CertificateError: hostname 'wrong.host.badssl.com' doesn't match either of '*.badssl.com', 'badssl.com'