I am new to networking and proxy. For a project I need to give a proxy connection.

I already have a connection and I want change the connection behavior of the process to connect through that proxy. I would also like it to use a new IP in the event that it detects that it has been throttled.

The new connection process that I want is: connect from our server -> proxy -> required site if we are throttled: establish new connection through proxy (need to confirm new IP is being allocated by the proxy).


Try this piece of code

proxy = urllib2.ProxyHandler({'http': ''})
opener = urllib2.build_opener(proxy)
  • Although the code is appreciated, it should always have an accompanying explanation. This doesn't have to be long but it is expected.
    – peterh
    Jun 17 '15 at 12:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.