Live data from Hacker News

Httpx: A next-generation HTTP client for Python

python-httpx.org

1–10 of 119 posts

Re: Httpx: A next-generation HTTP client for Python

#3
One of the highlighted features is directly calling into WSGI applications[1], which uses flask as an example.

Question: is there any advantage of this over flask’s builtin werkzeug test client?

[1] https://www.python-httpx.org/advanced/#calling-into-python-w...

[2] https://flask.palletsprojects.com/en/1.1.x/testing/

Re: Httpx: A next-generation HTTP client for Python

#5
httpx makes a pretty good first impression on me. The homepage provides examples, key selling points, install instructions, and links to any further reading one could hope for. However, I am missing one thing: The features this offers over the popular requests library do not seem to require httpx to be a competitor, but an extension or fork. There surely must be some major incompatibilities that allowed this library to do something fundamentally different, right?

Re: Httpx: A next-generation HTTP client for Python

#6
Finally a client that mixes async support and a “requests-compatible” API (for those times you don’t want to go as low as say an aiohttp or the like).

Looking forward to trying it out

Edit: maybe the homepage can include a very simple async example as well?

Re: Httpx: A next-generation HTTP client for Python

#8
post #5

httpx makes a pretty good first impression on me. The homepage provides examples, key selling points, install instructions, and links to any further reading one could hope for. However, I am missing one thing: The features this offers over the popular requests library do not seem to require httpx to be a competitor, but an extension or fork. There surely must be some major incompatibilities that allowed this library…

> The features this offers over the popular requests library do not seem to require httpx to be a competitor

Yes it has to be. Requests is not as great as everyone thinks it is. It's API is simple, sure, but when you need more advanced features (doesn't even support HTTP/2 AFAIK) like timeouts, proper exception handling (which you cannot do in requests)) it actually sucks.

httpx is a far superior library already!

Re: Httpx: A next-generation HTTP client for Python

#9
I've been using httpx 0.9.3 in production now for a couple months. I switched from requests when I realized I needed async support and it has been a dream to use.

The only issue I've run into has been with my attempt to reuse the same AsyncClient to make multiple concurrent requests to the same remote host. It looks like this issue may have been fixed in 0.10 or 0.11 so I'll be upgrading soon to check.

Also, be sure to check out the other fantastic projects by Encode. https://github.com/encode I stumbled upon httpx after using Starlette and Uvicorn for one of our microservices and and been pleasantly surprised by how easy to set up and use they are.

Post reply on HN