3 ms·
Hi, I maintain httpx. I'll try to answer your concerns. The API was not a question of preference. If you look at most http lib APIs (python requests included),
by chucke 7y ago
Hi, I maintain httpx. I'll try to answer your concerns.
The API was not a question of preference. If you look at most http lib APIs (python requests included), a single call returns a response object. My goal was to keep compatibility with this API to ease the migration effort, while baking in support for concurrent requests, which was the whole point of the lib.
There is no parallelism in that call btw. It's in the Readme. If it's http/2, it'll multiplex requests. If it's http/1, it'll try to pipeline, and if doesn't work, it'll fetch them one by one (with or without keep-alive). If they're different origins, the requests will be managed inside an event loop.
> Why not use composition instead?
You'll have to explain with an example of your own. However, there's already a ticket for implementing an event-based request handling, I just never prioritized it because no one asked for it yet, no one has shown interest in contributing, and frankly, I haven't needed it yet.
> Now you're stuck with this API forever.
It's still early 0.x days, so I might still remove APIs I don't think are future proof. That said, a lot of libs have lived with similar APIs all these years, and I don't see any reason for removing it.
- sudhirj 7y ago> It's still early 0.x days Any idea why the project is posted now? Is there a beta or RC release that’s significant?
- bovermyer 7y agoMy guess is that someone found it interesting and worth sharing with the HN community.
- jbverschoor 7y agoSuperb syntactical sugar.
- michaelbuckbee 7y agoHey, very impressed with httpx. I'm not in a spot to contribute code but would like to sponsor (if that's an option). My email's in my HN profile and apologies for dropping this into the thread I couldn't find contact info elsewhere.
- chucke 7y agoThx for the kind words. I thank, but will not accept financial contributions from individuals. Feel free to use it, modify it, or talk about it to your colleagues :)
- maximegarcia 7y agoNice lib, eager to use it in replacement of HTTP.rb, auto managed persistent connection is a great addition. Do you plan to support webmock and httplog ? Or add support for httpx into those ? Can't integrate a networking lib that can't be mocked in my specs.
- chucke 7y agoThx! I don't have any plans to integrate them, as I don't use any of them. But it should be trivial to create a plugin for them using the httpx plugin system: https://honeyryderchuck.gitlab.io/httpx/wiki/Custom-Plugins https://honeyryderchuck.gitlab.io/httpx/wiki/Custom-Plugins , feel free to give it a try. httpx also ships with its own request/response logger, set HTTPX_DEBUG=1 or set the options so that you see an example.