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

Make compatible with requests 2.29.0 and urllib3 2.0 #3116

Merged
merged 3 commits into from
May 5, 2023

Conversation

felixfontein
Copy link
Contributor

Fixes at least part of #3113. (Recent requests versions declare that they need urllib3 < 2.0 since at least 2017, so the urllib3 problems themselves shouldn't really appear except when forcing invalid combinations of requests and urllib3. My hope is that the urllib3 2.0 compatibility is something that only needs changes on the side of requests, and not here - but who knows...)

Since requests 2.29.0, requests uses urllib3's native chunking ability (see psf/requests#6226). By using urllib3's HTTPConnection class (which extends httplib.HTTPConnection`) we make sure that our HTTP transports support this as well.

I was able to reproduce the problem by calling APIClient.put_archive(); the change in this PR fixes the problem for me. (I'm working on a modified vendored version of Docker SDK for Python, so YMMV.)

Signed-off-by: Felix Fontein <felix@fontein.de>
@felixfontein
Copy link
Contributor Author

Failing CI (https://github.com/docker/docker-py/actions/runs/4861956711/jobs/8667665911?pr=3116) seems to be unrelated since it didn't fail before the force push (which only adjusted the commit message). Restarting CI.

@felixfontein
Copy link
Contributor Author

As a reference, the first test run that didn't fail: https://github.com/docker/docker-py/actions/runs/4861929164/jobs/8667601939

@felixfontein
Copy link
Contributor Author

According to #3117 and #3113 (comment) this also fixes compatibility with urllib3 2.0, once requests officially supports that.

@felixfontein felixfontein changed the title Make compatible with requests 2.29.0 Make compatible with requests 2.29.0 and urllib3 2.0 May 2, 2023
…lib3.

Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
@felixfontein
Copy link
Contributor Author

@milas can you take a look at this PR? Thanks.

Copy link
Contributor

@milas milas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I verified several scenarios under the integration tests (there are calls to put_archive and I see the failures currently without this PR):

  • requests 2.30.0 + urllib3 v2.x
  • requests 2.28.x + urllib3 v1.x
  • requests 2.30.0 + urllib3 v1.x

Looks good across the three. I'll get this merged and a new release tagged momentarily.

@milas milas merged commit 3178c8d into docker:main May 5, 2023
JonasPammer added a commit to JonasPammer/cookiecutter-ansible-role that referenced this pull request May 5, 2023
as done in JonasPammer/ansible-role-bootstrap#83
i think the whole reason i started said PR was because I wondered "why cap it at that without reason?".
molecule-plugins[docker] brings the docker dep, with a fitting ">" delimiter which for example brings us docker/docker-py#3116 thus this PR closes #103
@felixfontein
Copy link
Contributor Author

@pquentin @milas thanks a lot for reviewing, testing, and merging!

@josephkishan
Copy link

@pquentin @milas @felixfontein we facing the same issue like "TypeError: request() got an unexpected keyword argument 'chunked'" We are using docker as 5.0.3 and requests as 2.30.0 and urllib3 as 2.0.2. Is these versions fine or do we need to pin the version until the issue resolves? If we have to pin then please suggest to us the versions we need to resolve this issue

@pquentin
Copy link

pquentin commented May 9, 2023

@josephkishan You can keep requests 2.30.0 and urllib3 2.0.2, but you should upgrade docker to 6.1.0 or 6.1.1.

k-v1 added a commit to k-v1/sonic-buildimage that referenced this pull request May 9, 2023
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request May 10, 2023
yxieca pushed a commit to sonic-net/sonic-buildimage that referenced this pull request May 15, 2023
…15050)

Fix #14974
Refs: docker/docker-py#3116

Co-authored-by: Konstantin Vasin <126960927+k-v1@users.noreply.github.com>
mssonicbld pushed a commit to sonic-net/sonic-buildimage that referenced this pull request May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants