我有两个网络接口(wifi和以太网)都可以上网。假设我的接口是eth
(以太网)和wlp2
(wifi)。我需要特定的请求通过eth
接口,其他请求通过wpl2
。在
比如:
// Through "eth"
request.post(url="http://myapi.com/store_ip", iface="eth")
// Through "wlp2"
request.post(url="http://myapi.com/log", iface="wlp2")
我使用的是requests
,但是如果没有任何方法可以使用pycurl
或{requests
。在
How to specify source interface in python requests module?引用Requests, bind to an ip,它不起作用。在
尝试将内部IP(192.168.0.200)更改为下面代码中相应的iface。在
我找到了一种使用
pycurl
的方法。这很有魅力。在我把问题打开了,希望有人能用
requests
给出答案。在相关问题 更多 >
编程相关推荐