Ensure HTTPError.response is not None
The implementation of `HTTPError` in `requests` does not guarantee that the `response` property will always be set. So we need to ensure it is not `None` before looking for the return code, for example. This also makes mypy checks pass again, as `types-request` was updated in 2.31.0.9 to better match this particular aspect. See: https://github.com/python/typeshed/pull/10875
This commit is contained in:
parent
968ddef295
commit
7344d264e7
7 changed files with 8 additions and 2 deletions
|
@ -125,7 +125,7 @@ class BitbucketLister(Lister[BitbucketListerState, List[Dict[str, Any]]]):
|
|||
body = self.http_request(self.url, params=self.url_params).json()
|
||||
yield body["values"]
|
||||
except HTTPError as e:
|
||||
if e.response.status_code == 500:
|
||||
if e.response is not None and e.response.status_code == 500:
|
||||
logger.warning(
|
||||
"URL %s is buggy (error 500), skip it and get next page.",
|
||||
e.response.url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue