Does urllib3 support HTTP/2 Requests? Will it?
Asked Answered
C

2

9

I know the following about various python HTTP libraries:

The other major HTTP request library I'm aware of is urllib3. This is what OpenAPI Generator uses by default when generating python client libraries.

My Questions are:

Can urrlib3 be configured to make HTTP/2 requests?

I cannot find any information on http2 support in the documentation, and through my testing of a generated OpenAPI client, all requests are HTTP/1.1. If the answer is no currently, are the maintainers planning HTTP/2 support? I cannot find any evidence of this in the project's open issues.

Crosspollination answered 13/4, 2022 at 14:6 Comment(1)
HTTP/2 requires a complete rewrite. The external interface can be the same, but the implementation is totally different. I doubt you'll see any of the existing libraries add HTTP/2 support -- you'll see new libraries written from scratch.Baldachin
C
9

I asked about this in the urllib3 discord, and got an answer from one of the maintainers that corroborates what Tim Roberts commented;

  • Proper HTTP/2 implementations require async/await to take advantage of the main different feature in HTTP/2, which is making requests in parallel.
  • urllib3 in particular is not planning to support this because it'll in general require a rewrite.
Crosspollination answered 14/4, 2022 at 15:49 Comment(0)
W
0

There is an alternative to the listed HTTP/2 clients: pycurl can perform HTTP/2 requests very efficiently if libcurl is compiled with HTTP/2 support (same apply to HTTP/3). The drawback is it's more complex to install.

Wishbone answered 19/1, 2023 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.