Skip to content

Commit

Permalink
Merge pull request #410 from vphilippon/urllib3-126-compat
Browse files Browse the repository at this point in the history
closes #411
  • Loading branch information
gabrielfalcao committed Nov 24, 2020
2 parents b0f0791 + 1517b02 commit aa7e7b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions httpretty/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,14 @@ def __getattr__(self, name):
# calls (or can they?)
self.truesock = self.create_socket()
elif not self.truesock:
# Special case for
# `hasattr(sock, "version")` call added in urllib3>=1.26.
if name == 'version':
raise AttributeError(
"HTTPretty synthesized this error to fix urllib3 compatibility "
"(see issue https://github.com/gabrielfalcao/HTTPretty/issues/409). "
"Please open an issue if this error causes further unexpected issues."
)
raise UnmockedError()
return getattr(self.truesock, name)

Expand Down

0 comments on commit aa7e7b7

Please sign in to comment.