Found using mypy 0.990.
Fix mypy error by excluding both imports in the try-except block.
Type-narrow the `ex.request` variable with an assert.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
from .settings import Settings
try:
- from requests.packages.urllib3.exceptions import SSLError
+ from requests.packages.urllib3.exceptions import SSLError # type: ignore
except ImportError:
from urllib3.exceptions import SSLError # type: ignore
method.upper(), str(ex))
raise RequestException(str(ex))
except Timeout as ex:
+ assert ex.request
msg = "{} REST API {} timed out after {} seconds (url={}).".format(
self.client_name, ex.request.method, Settings.REST_REQUESTS_TIMEOUT,
ex.request.url)