Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/urllib3/connectionpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,8 @@ def urlopen(
assert isinstance(response, ResponsePromise)
return response # actually a response promise!

assert isinstance(response, HTTPResponse)
if not isinstance(response, HTTPResponse):
warnings.warn(f"Expected {type(response)} to be a subclass of HTTPResponse")

if redirect and response.get_redirect_location():
# Handle redirect?
Expand Down
4 changes: 3 additions & 1 deletion src/urllib3/poolmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,9 @@ def urlopen(
# the established connection is not capable of doing multiplexed request
kw["multiplexed"] = False

assert isinstance(response, HTTPResponse)
if not isinstance(response, HTTPResponse):
warnings.warn(f"Expected {type(response)} to be a subclass of HTTPResponse")

redirect_location = redirect and response.get_redirect_location()
if not redirect_location:
return response
Expand Down
Loading