-
-
Notifications
You must be signed in to change notification settings - Fork 845
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
Add the 'proxy' parameter and deprecate 'proxies'. #2879
Conversation
@encode/maintainers If we want to switch to this API, I can work on the documentation. I don't want to rush API changes, but if we believe the |
Yep seems like a clear API rationalisation to me, I'd be happy for us to make this switch for 1.0. It woud probably also make sense for us to widen the available types for the client = httpx.Client(
mounts={
"http://": httpx.HTTPTransport(proxy="http://127.0.0.1:80"),
"https://": httpx.HTTPTransport(proxy="https://127.0.0.1:443"),
}
) |
d71deba
to
88eb99b
Compare
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
Okay, so I can say that we should carefully consider how we will document this. That new PR should answer this question:
I also want that PR will make HTTPX documentation more user-friendly and add some Mkdocs material features that can possibly make the documentation more readable and pleasant. |
Excellent questions, though quite wide ranging. For the purposes of this pull request I'd suggest that...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
The command-line client also currently uses --proxies
- I'd suggest we change that also.
For example here...
Line 72 in e63b659
"--proxies [cyan]URL", |
as well as in a few other places in that module.
Do we want to keep the proxies argument in the cli app? |
I'm happy with making that change, yes. |
Seems like a nice change to me, helps simplify things a bit. Once we've merged this one we're prob committing ourselves to a major version we okay with that? |
Let's put this in the next minor version for now, and then we'll completely switch to the new API with HTTPX 1.0 🎉 |
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
Looking great. Let's...
|
Yes
Is there a reason we need to get rid of docstring? I thought we were going to remove everything related to |
Summary
HTTPX supports
proxies
andmounts
arguments, which are not the same, butmounts
can simply replaceproxies
for complex routing, which is not always used.So for simplicity, this PR deprecates
proxies
and addsproxy
argument.You can still use
proxies
, but it will warn you that it is deprecated and that you should use the new API.Use...
proxy
if you want to use a proxy server for all your requests.mounts
if you want to use a proxy server for requests matching the URL pattern you specified.Proxy
Mounts