小编epi*_*nal的帖子

通过特定的网络接口发送http请求

我有两个可以同时访问互联网的网络接口(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")
Run Code Online (Sandbox Code Playgroud)

我正在使用requests,但是我可以使用pycurlurllib如果没有任何方法可以使用它requests

如何在python请求模块中指定源接口?指的是请求,绑定到一个IP,它不起作用。

python python-requests

7
推荐指数
3
解决办法
2694
查看次数

标签 统计

python ×1

python-requests ×1