-
-
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 httpx.NetworkOptions
configuration.
#3052
base: master
Are you sure you want to change the base?
Conversation
NetworkOptions
httpx.NetworkOptions
configuration.
I would like to ask that something be added to the documentation at advanced usage, please. I would like you to add something such as: "This is how you force httpx to use IPv4 even if it can use IPv6. Using IPv6 is the default. My proposed change will make it so that if somebody searches for "IPv4", it will be found. Currently, it was very hard to find until I was told what to look for. Of course, once I was told what to look for, it was immediately obvious. Thank you. Commendation to karpetrosyan for his quick response to my question! My earlier comment about IPv4 mapped IPv6 addresses is not a function of httpx. It is a "feature" of nginx. I was able to verify using tcpdump that httpx works correctly as explained to me. |
Here is the |
I have added an example for the |
Maybe we should also add a changelog |
Refs #947 (comment)
Here's how the proposed documentation looks...
Network Options
There are several advanced network options that are made available through the
httpx.NetworkOptions
configuration class.Configuration
The options available on this class are...
connection_retries
Configure a number of retries that may be attempted when initially establishing a TCP connection. Defaults to
0
.local_address
Configure the local address that the socket should be bound too. The most common usage is for enforcing binding to either IPv4
local_address="0.0.0.0"
or IPv6local_address="::"
.socket_options
Configure the list of socket options to be applied to the underlying sockets used for network connections.
For example, you can use it to explicitly specify which network interface should be used for the connection in this manner:
uds
Connect to a Unix Domain Socket, rather than over the network. Should be a string providing the path to the UDS.
Design options that we have here...
httpx.Client(network_options=...)
shortcut, in the same way we do for eg.ssl_context=...
,proxy=...
,limits=...
,version=...
.Limits
andNetworkOptions
all be part of the same single config class. Includingmax_keepalive_connections
,max_connections
,keepalive_expiry
on this class.