From 48d0a2e453f6635af343000cdaf9794a781e807e Mon Sep 17 00:00:00 2001 From: Igor Gumenyuk Date: Mon, 23 Dec 2024 18:48:22 +0200 Subject: [PATCH] Fixed missing `version_string` attribute when used with urllib3>=2.3.0 urllib3 in v2.3.0 introduced attribute `version_string` (https://github.com/urllib3/urllib3/pull/3316/files). This attribute is missing in `VCRHTTPResponse` which causes errors like AttributeError: 'VCRHTTPResponse' object has no attribute 'version_string' This fixes https://github.com/kevin1024/vcrpy/issues/888 --- vcr/stubs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index 4d4bb39dc..aaad91b1b 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -66,6 +66,7 @@ def __init__(self, recorded_response): self.reason = recorded_response["status"]["message"] self.status = self.code = recorded_response["status"]["code"] self.version = None + self.version_string = None self._content = BytesIO(self.recorded_response["body"]["string"]) self._closed = False self._original_response = self # for requests.session.Session cookie extraction