|
发表于 2015-10-13 16:56:15
|
显示全部楼层
发送什么东西?
linux可以设置出口ip
windows可以命令行切换出口ip(慢)
可以在代码里面bind ip这个效率高,部分代码如下
- class BoundHTTPHandler(urllib2.HTTPHandler):
- def __init__(self, source_address = None, debuglevel = 0):
- urllib2.HTTPHandler.__init__(self, debuglevel)
- self.http_class = functools.partial(httplib.HTTPConnection,
- source_address = source_address)
- def http_open(self, req):
- return self.do_open(self.http_class, req)
- handler = BoundHTTPHandler(source_address = (ip, 0))
- opener = urllib2.build_opener(handler)
- urllib2.install_opener(opener)
复制代码
|
|