Skip to content

cachecontrol is incompatible with Requests 2.30.0 #292

@pgjones

Description

@pgjones

Activity

notenti

notenti commented on May 3, 2023

@notenti

What would make more sense here? Pinning requests so it's <2.30? Or updating the logic so strict isn't referenced?

elijahr

elijahr commented on May 3, 2023

@elijahr

The comment on that issue suggests this is from urllib3 >= 2 being used: psf/requests#6437 (comment)

this appears to be an incompatibility in cachecontrol with the new release of urllib3 2.0. strict is no longer a supported argument on the HTTPResponse class. For the time being you'll likely need to pin to an older version of urllib3 or work with the cachecontrol team to update their usage.

Perhaps the fix would be to check urllib3's major version and expect a different HTTPResponse shape based on whether it is 1 or greater than 1.

notenti

notenti commented on May 3, 2023

@notenti

Based on this diff it looks like strict isn't supported at all in python 3. Could we just do a plain ole getattr call to default to 0 if it's not present? Looks like that's what was happening upstream of this library anyways

sww314

sww314 commented on May 3, 2023

@sww314

I believe the issue is actually urllib > 2.
Here is the issue in the urllib3 repo. As a work around pinning urllib version works.

The suggested gettattr solution seems like a clean fix in cachcontrol.

urllib3/urllib3#3010

You can fix it by pinning:
urllib3==1.26.15 # https://pypi.org/project/urllib3/

sethmlarson

sethmlarson commented on May 3, 2023

@sethmlarson
Member

Maintainer of urllib3 here! I'd recommend the getattr approach regardless of what gets done in urllib3 in the short-term, long-term the property won't be available on HTTPResponse or HTTPConnection (and defaults to True in terms of behavior).

ghost

ghost commented on May 4, 2023

@ghost

This issue came up today for us; the workaround was to use requests 2.29.0

added a commit that references this issue on May 4, 2023

88 remaining items

added a commit that references this issue on May 25, 2023
8f037ba
added a commit that references this issue on Jun 2, 2023
garchaaman19

garchaaman19 commented on Jun 7, 2023

@garchaaman19

We fixed by pinning urllib3:

urllib3==1.26.15 # https://pypi.org/project/urllib3/

The problem is not requests.

This worked for me.

added a commit that references this issue on Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @elijahr@ionrock@jacobg@xytxytxyt@pgjones

      Issue actions

        cachecontrol is incompatible with Requests 2.30.0 · Issue #292 · psf/cachecontrol