hcloud-python icon indicating copy to clipboard operation
hcloud-python copied to clipboard

Use HTTP/2 instead of 1.1

Open betelgeuse opened this issue 3 months ago • 2 comments

Feature Request

Is your feature request related to a problem? Please describe.

Currently requests are done with HTTP 1.1:

>>> client.servers.get_all()
2025-11-11 13:25:32,402 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.hetzner.cloud:443
2025-11-11 13:25:32,630 - urllib3.connectionpool - DEBUG - https://api.hetzner.cloud:443 "GET /v1/servers?page=1&per_page=50 HTTP/1.1" 200 178

Describe the solution you'd like

The requests should use HTTP 2 for better performance as the servers do support it

$ curl -i https://api.hetzner.cloud
HTTP/2 404 

Describe alternatives you've considered

Staying with HTTP 1.1 and accepting worse performance.

Teachability, Documentation, Adoption, Migration Strategy

urllib3 underpinning requests does not support HTTP 2 so this requests switching the library.

https://github.com/urllib3/urllib3/milestone/10

Here httpx is suggested as an alternative. Would it be acceptable?

https://webscraping.ai/faq/urllib3/can-i-use-urllib3-with-http-2-protocol

betelgeuse avatar Nov 11 '25 11:11 betelgeuse

Is that an actual problem for your usage of the SDK?

jooola avatar Nov 11 '25 12:11 jooola

Is that an actual problem for your usage of the SDK?

My experience with https://github.com/ansible-collections/hetzner.hcloud has been rather slow performance so I started thinking about improvements to the stack. However, I haven't done proper research whether HTTP/2 would make a difference. It would make sense though that things like multiplexing pagination would be useful.

betelgeuse avatar Nov 11 '25 13:11 betelgeuse