Provide request_class, response_class for httpx.Client
Summary
Closes #717
Checklist
- [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [ ] I've updated the documentation accordingly.
httpx.Reponse.raise_for_status() need to return Self instead of Response, which is added in py311.
So we need typing_extensions.Self in lower version.
or we can use def raise_for_status(self: Type[T]) -> T: instead.
Should also consider add a generic typing for response type and request type of client instance.
generic type for request and response type
https://github.com/encode/httpx/issues/717#issuecomment-2118083691
return type of httpx.Reponse.raise_for_status still need to update
Hi! Just wondering what's the status on this? Is there any intention to get it merged?
Hello, thanks to all involved for the great work! Are there any updates with respect to this PR? It would be very useful atm :sweat_smile:
any news for this PR?
@MarcBresson I'm not progressing this because the work on the httpx 1.0 prerelease deals with this much more comprehensively. (To the point that implementing a custom client class is really simple to implement)
Eg. There's a worked through example on https://www.encode.io/httpnext/clients "Custom client implementations" - contrast that with the existing Client implementation and signatures if you want to start getting a feel for how much sharper and neater the 1.0 typing is.
And, yes... it's taking a little time for me to start presenting the work fully... it's on the way