Uh oh!
There was an error while loading. Please reload this page.
How to send http request through specific network interface? #2635
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have two network interfaces and both with internet access. Let's say my interfaces are eth0 and ETH999. I need specific requests to go through ETH999 interface and eth0 is the default interface in my server. so how to do the same on Httpx? thanks. |
Replies: 2 comments 5 replies
Hi there. Is this what you're looking for?... https://www.python-httpx.org/advanced/#custom-transports
>>>importhttpx>>>transport=httpx.HTTPTransport(local_address="0.0.0.0")
>>>client=httpx.Client(transport=transport) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Since #2716 has been merged, hopefully this api will provide the answer to your question beginning with version 0.24.2. >>>importhttpx>>>socket_options= [(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, b"ETH999")]
>>>transport=httpx.HTTPTransport(socket_options=socket_options)
>>>client=httpx.Client(transport=transport) |
Since #2716 has been merged, hopefully this api will provide the answer to your question beginning with version 0.24.2.