Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing request.version_string attribute with urllib3 == 2.3.0 #888

Closed
tadams42 opened this issue Dec 22, 2024 · 4 comments · Fixed by #889 or exslim/vcrpy#1
Closed

missing request.version_string attribute with urllib3 == 2.3.0 #888

tadams42 opened this issue Dec 22, 2024 · 4 comments · Fixed by #889 or exslim/vcrpy#1

Comments

@tadams42
Copy link

Tried re-creating cassette that causes error.

Works with urllib3 == 2.2.3.

Changing boto3 version doesn't seem to have any impact.

Traceback:

Aliases for entries in sys.path:
    <site>: /*********/.venv/lib/python3.12/site-packages/
Traceback (most recent call last):
    <site> botocore/httpsession.py:464    send           urllib_response = conn.urlopen(
    <site> urllib3/connectionpool.py:787  urlopen        response = self._make_request(
    <site> urllib3/connectionpool.py:551  _make_request  response.version_string,
AttributeError: 'VCRHTTPResponse' object has no attribute 'version_string'

During handling of the above exception, another exception occurred:

Aliases for entries in sys.path:
    <site>: /**********/.venv/lib/python3.12/site-packages/
    <pwd> : /**********/
Traceback (most recent call last):
    <pwd> *********/files_storage.py:125           upload                    response = self.s3_client.put_object(
    <site> botocore/client.py:569                          _api_call                 return self._make_api_call(operation_name, kwargs)
    <site> botocore/client.py:1005                         _make_api_call            http, parsed_response = self._make_request(
    <site> botocore/client.py:1029                         _make_request             return self._endpoint.make_request(operation_model, request_dict)
    <site> botocore/endpoint.py:119                        make_request              return self._send_request(request_dict, operation_model)
    <site> botocore/endpoint.py:200                        _send_request             while self._needs_retry(
    <site> botocore/endpoint.py:360                        _needs_retry              responses = self._event_emitter.emit(
    <site> botocore/hooks.py:412                           emit                      return self._emitter.emit(aliased_event_name, **kwargs)
    <site> botocore/hooks.py:256                           emit                      return self._emit(event_name, kwargs)
    <site> botocore/hooks.py:239                           _emit                     response = handler(**kwargs)
    <site> botocore/retryhandler.py:207                    __call__                  if self._checker(**checker_kwargs):
    <site> botocore/retryhandler.py:284                    __call__                  should_retry = self._should_retry(
    <site> botocore/retryhandler.py:307                    _should_retry             return self._checker(
    <site> botocore/retryhandler.py:363                    __call__                  checker_response = checker(
    <site> botocore/retryhandler.py:247                    __call__                  return self._check_caught_exception(
    <site> botocore/retryhandler.py:416                    _check_caught_exception   raise caught_exception
    <site> botocore/endpoint.py:279                        _do_get_response          http_response = self._send(request)
    <site> botocore/endpoint.py:383                        _send                     return self.http_session.send(request)
    <site> botocore/httpsession.py:509                     send                      raise HTTPClientError(error=e)
HTTPClientError: An HTTP Client raised an unhandled exception: 'VCRHTTPResponse' object has no attribute 'version_string'
@nschloe
Copy link

nschloe commented Dec 23, 2024

This is the relevant urllib3 PR: urllib3/urllib3#3316

exslim added a commit to exslim/vcrpy that referenced this issue Dec 23, 2024
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 kevin1024#888
@exslim
Copy link
Contributor

exslim commented Dec 23, 2024

Pull request to fix this issue: #889

@decitre
Copy link

decitre commented Dec 24, 2024

I could workaround this issue with a:

@pytest.fixture(autouse=True)
def patch_VCRHTTPResponse_version_string():
    from vcr.stubs import VCRHTTPResponse
    if not hasattr(VCRHTTPResponse, 'version_string'):
        VCRHTTPResponse.version_string = None
    yield  

@kevin1024
Copy link
Owner

FYI the new release 7.0.0 should resolve this issue.

scottstanie added a commit to scottstanie/opera-utils that referenced this issue Jan 3, 2025
scottstanie added a commit to opera-adt/opera-utils that referenced this issue Jan 3, 2025
* Fix second datetime in CSLC name to be `generation_datetime`

* Allow Sentinel-1 C,D (?E)

* fix testg

* Fix geojson dump for GDAL 3.10

This format seems to be incompatible with the latest GDAL. Testing it on geojsonlint.com also doesnt like it. Perhaps the "type" needs to be earlier, or at a top-level key, and before 3.10 GDAL would just guess.

* add workaround for kevin1024/vcrpy#888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants