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
|
@ -135,7 +135,8 @@ class GogsLister(Lister[GogsListerState, GogsListerPage]):
|
|||
response = self.http_request(url, params=params)
|
||||
except HTTPError as http_error:
|
||||
if (
|
||||
http_error.response.status_code == 500
|
||||
http_error.response is not None
|
||||
and http_error.response.status_code == 500
|
||||
): # Temporary hack for skipping fatal repos (T4423)
|
||||
url_parts = urlparse(url)
|
||||
query: Dict[str, Any] = dict(parse_qsl(url_parts.query))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue