requests-unixsocket icon indicating copy to clipboard operation
requests-unixsocket copied to clipboard

Inherit HTTPConnection through urllib3.connection, not httplib

Open mupuf opened this issue 2 years ago • 28 comments

By inheriting from urllib3.connection.HTTPConnection (that inherits from httplib.HTTPConnection itself), we can adapt to the internal changes in urllib3 2.0 that added a request() method that is incompatible with httplib.HTTPConnection.request.

This fixes the incompatibility between urllib3 2.0 and requests 1.26+, which was the first version that stopped vendoring urllib3.

Reference: https://github.com/docker/docker-py/issues/3113#issuecomment-1531570788

mupuf avatar May 05 '23 06:05 mupuf

Thanks for figuring this out. I can confirm that with this patch, tests on both requests-unixsocket itself and on cheroot (using requests-unixsocket) pass. I'm going to carry it into Gentoo.

mgorny avatar May 21 '23 04:05 mgorny

@mupuf could you add Fixes #70 somewhere in the PR description?

webknjaz avatar May 29 '23 13:05 webknjaz

@msabramo this is a fix to a far-reaching issue. Would you mind merging it?

webknjaz avatar May 29 '23 13:05 webknjaz

Yes, @msabramo this is effecting our key applications. Can confirm the patch works in production. Merging would be appreciated.

oschwartz10612 avatar Jun 01 '23 16:06 oschwartz10612

@msabramo Can you please merge this or give the rights to somebody to do it?

olemoign avatar Sep 05 '23 17:09 olemoign

@msabramo Can you please merge this or give the rights to somebody to do it?

Yes please, this a problem for me too. I would appreciate a merge and then a new release on pypi.

thebaptiste avatar Sep 11 '23 16:09 thebaptiste

@mupuf May be you could create a tag 0.3.1 or 0.4.0 (greater than release 0.3.0 on pypi) in your forked repo mupuf/requests-unixsocket ? So I could use this tag with a git+https requirement on your repo. Of course, I could create my own fork, but as this fix is yours I would prefer to use your fork than mine !

thebaptiste avatar Sep 12 '23 09:09 thebaptiste

@mupuf May be you could create a tag 0.3.1 or 0.4.0 (greater than release 0.3.0 on pypi) in your forked repo mupuf/requests-unixsocket ? So I could use this tag with a git+https requirement on your repo. Of course, I could create my own fork, but as this fix is yours I would prefer to use your fork than mine !

Already done in May: https://github.com/mupuf/requests-unixsocket/releases/tag/v0.2.1

mupuf avatar Sep 12 '23 09:09 mupuf

Already done in May: https://github.com/mupuf/requests-unixsocket/releases/tag/v0.2.1

Indeed, but 0.2.1 is lesser than 0.3.0 on pypi (even if this tag 0.3.0 should not be missing in git), so may be it's a little confusing to update from 0.3.0 (from pypi) to 0.2.1 (from git). Thanks anyway for your fix, it works fine and allow me to use requests-unixsocket with the last releases of both requests and urllib3

thebaptiste avatar Sep 12 '23 09:09 thebaptiste

This is urgently needed by many projects who get errors by its users who pull the last version of requests-unixsocket from pypi. @msabramo : do you think there is something holding off the merging of this? Thanks!

cquike avatar Oct 17 '23 13:10 cquike

+1 I am affected by this.

erjoalgo avatar Oct 30 '23 00:10 erjoalgo

I worked around this error using the following one-liner, which asks pip to install the fix from this branch:

pip install git+https://github.com/mupuf/requests-unixsocket --break-system-packages

Hopefully the fix will be merged soon.

erjoalgo avatar Oct 30 '23 01:10 erjoalgo

Don't throw --break-system-packages around. Somebody is going to copy this and break their system one day. If one needs it for whatever reason, they'll add this option.

webknjaz avatar Oct 31 '23 11:10 webknjaz

@mupuf how you feel about sticking your fork into some shared maintenance org and setting up publishing to PyPI under a different project name, like requests-unixsocket-urllib3-v2? Could move to one of the existing orgs or make a new one...

webknjaz avatar Oct 31 '23 13:10 webknjaz

@webknjaz: I agree, it is time for someone to fork this project and become the new maintainer. This person won't however be me, so feel free to step up :)

mupuf avatar Nov 01 '23 08:11 mupuf

@mupuf I'm not talking about full maintenance, just publishing this patch and having a mechanism for letting other people start maintaining the thing. I also don't need to maintain it beyond making it installable from a more permanent location...

webknjaz avatar Nov 01 '23 08:11 webknjaz

I have reached out to @msabramo over the email listed on his profile. I will let you know if I hear back. If needed, I can fork and setup publishing so we all can pull from a reliable source.

oschwartz10612 avatar Nov 15 '23 05:11 oschwartz10612

Any update on getting this fix merged and released? Could we perhaps convince PSF (since they already control requests) or Jazzband to take over this project?

crgwbr avatar Dec 28 '23 16:12 crgwbr

Jazzband won't accept it. I asked. There should still be a project leader and willingness to transfer.

webknjaz avatar Dec 28 '23 17:12 webknjaz

For what it's worth: https://github.com/parsys-telemedicine/requests-unixsocket (diff is only the fix) https://pypi.org/project/parsys-requests-unixsocket/

olemoign avatar Jan 11 '24 14:01 olemoign

it would be really good to merge this PR and release new version.

kloczek avatar Apr 06 '24 23:04 kloczek

Since this project seems to be abandoned, but its longevity is important to my team, we've forked the project as requests-unixsocket2. It should be a drop in replacement for this package.

  • PyPI: https://pypi.org/project/requests-unixsocket2/0.4.0/
  • Repository: https://gitlab.com/thelabnyc/requests-unixsocket2
  • Clone of this PR: https://gitlab.com/thelabnyc/requests-unixsocket2/-/merge_requests/1

We've migrated this PR there, merged it, and released to PyPI as part of v0.4.0.

crgwbr avatar May 22 '24 21:05 crgwbr

Since this project seems to be abandoned, but its longevity is important to my team, we've forked the project as requests-unixsocket2. It should be a drop in replacement for this package.

Are you planning to actively maintain the project going forward, or just keep it alive? If the former, why not open a PEP 541 request to take the original name? They take around forever to process, so the sooner the better.

mgorny avatar May 23 '24 12:05 mgorny

We're using it production on several actively developed projects, so I anticipate keeping it compatible with up-to-date requests/urllib3. But we're not at the moment looking to add a ton of new features/refactoring/etc, if that's what you mean. PRs are of course welcome if you have something in mind.

crgwbr avatar May 23 '24 13:05 crgwbr

@crgwbr if you could take over the original name as suggested by @mgorny that'd ensure a smooth transition for everyone.

simondeziel avatar May 24 '24 16:05 simondeziel

Taking over the original name would probably also alleviate some transition pains for downstream. See for instance this Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2284361

cquike avatar Jul 02 '24 15:07 cquike

The previous fork by mupuf appeared to stop working for me, so I'm now using:

pip install git+https://gitlab.com/thelabnyc/requests-unixsocket2

from this comment

erjoalgo avatar Aug 19 '24 17:08 erjoalgo

fwiw, @erjoalgo, you don't need to install as a git dependency. We're publishing the fork to PyPI (https://pypi.org/project/requests-unixsocket2/), so you can just do this:

pip install requests-unixsocket2

crgwbr avatar Aug 20 '24 14:08 crgwbr