Controlling source IP address within urllib2

Dan tojuso at hotmail.com
Sat Jun 4 01:02:22 CEST 2005


Does anybody know how to control the source IP address (IPv4) when
using the urllib2 library?  I have a Linux box with several IP
addresses in the same subnet, and I want to simulate several
individuals within that subnet accessing web pages independently.  I
need the functionality of urllib2 because there will be redirects and
other HTTP-type functions to implement.  It would be nice if I could
create (and bind) sockets myself and then tell the urllib functions to
use those sockets.  Perhaps there is some sort of "back-door" way of
doing this??? Any hints are appreciated!
-Dan




More information about the Python-list mailing list