首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
V2EX
›
setiepr
›
全部回复第 1 页 / 共 1 页
回复总数
3
2016-04-05 18:29:56 +08:00
回复了
yuexiande
创建的主题
›
Python
›
如何实现 request 指定使用出口 ip
import socket
real_create_conn = socket.create_connection
def set_src_addr(*args):
address, timeout = args[0], args[1]
source_address = ('IP_ADDR_TO_BIND_TO', 0)
return real_create_conn(address, timeout, source_address)
socket.create_connection = set_src_addr
import requests
r = requests.get('
http://www.google.com
')
2016-04-05 18:29:20 +08:00
回复了
yuexiande
创建的主题
›
Python
›
如何实现 request 指定使用出口 ip
use module socket
http://stackoverflow.com/questions/12585317/requests-bind-to-an-ip
2016-04-05 18:17:01 +08:00
回复了
OneAPM
创建的主题
›
推广
›
你消费我买单——致有应用层安全防护需求的你!!!
很赞的活动。
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
1912 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms ·
UTC 16:25
·
PVG 00:25
·
LAX 09:25
·
JFK 12:25
Developed with
CodeLauncher
♥ Do have faith in what you're doing.