Skip to content

How to send http request through specific network interface? #2635

Answered by karpetrosyan
ChrisYP asked this question in General
Discussion options

You must be logged in to vote

Since #2716 has been merged, hopefully this api will provide the answer to your question beginning with version 0.24.2.

>>> import httpx
>>> socket_options = [(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, b"ETH999")]
>>> transport = httpx.HTTPTransport(socket_options=socket_options)
>>> client = httpx.Client(transport=transport)

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@ChrisYP
Comment options

@tomchristie
Comment options

@ChrisYP
Comment options

@tomchristie
Comment options

@tomchristie
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tomchristie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2631 on March 27, 2023 11:31.