Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HTTPError
has 2 attributesrequest
andresponse
. Both are expected by users to be notNone
but it was not really enforced at any level (typed asAny
). Sincetypes-requests==2.31.0.4
, the types are now enforced to berequests.Request
andresponse.Response
. This PR adapts the current code to set the request/response attributes correctly whenever possible. However this is not always possible due to how our errors are built (it happens in rare cases that we raise a HTTPError even though it's not really a HTTPError per-se). I think enforcing request/response whenever possible + ignore other errors is fine for now. Let's reassess if at any point some users complain.See the related python/typeshed#8989 and python/typeshed#10740.