New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some more public APIs? #106
Comments
For the particular case of UDS, I think this is strongly related to #88, "advanced connection options"… Don't know if there's a way we could allow passing a pre-configured |
@notpushkin My POC there is a bit old now — we didn't have the transport API nor HTTPCore at the time. So I gave this a second try myself and arrived to this gist, an The key to simplify things was to note that we don't actually need any kind of connection pooling for UDS (since there's only one connection, i.e. the one via the Unix socket). So the implementation there is a vanilla async transport, which manages an So the two bits of currently private HTTPCore API I needed were: from httpcore._async.connection import AsyncHTTPConnection
from httpcore._backends.asyncio import SocketStream And relying on the fact that |
To be honest, though, most of the code in
So I switched to from httpcore._async.http11 import AsyncHTTP11Connection
from httpcore._backends.asyncio import SocketStream |
Thanks for taking time to loo into this! Your implementation looks much cleaner than mine (at a cost of dropping HTTP/2 support, which of course doesn't make much sense with UDS :)
Just noticed in your example that exceptions are in fact a part of the public interface so this side note isn't strictly valid (but a mention in docs would be really great! Should I send a PR sometime after I finish my current project?) |
I'd be keen for us to push back on expanding the API surface area wherever possible, for as long as we can. @florimondmanca's suggestions wrt. connection pooling and HTTP/1.1 vs HTTP/2 w/ UDS are really valid here. A really good starting point would be for someone to thrash out a proof of concept of a UDS transport class, based on our |
Hello, Since exceptions are now public, and we're now tracking UDS support via #138, I'll close this… |
Hey there and thanks for your awesome libraries!
I was planning on reviving @florimondmanca's https://github.com/florimondmanca/httpx-unixsocket-poc. I've managed to get it working but hesitate publishing a proper package for now as it's tightly coupled with things that are now private APIs.
I understand that publishing a lot of APIs might not be in scope for httpcore but it is useful in some cases like this one. Are there any plans to...
httpcore._backends.asyncio.SocketStream
andhttpcore._async.connection.AsyncHTTPConnection
?AsyncHTTPConnection
to take a custom backend as an input?Also, publishing
httpcore._exceptions
and maybehttpcore._types
might be a good idea as those are useful on the outside of the library (e. g. the only way to catchTimeoutException
only is to import it from the private module :-)The text was updated successfully, but these errors were encountered: