Shruti Srivastava
Shruti Srivastava

Reputation: 398

How to configure proxy using Squid

I 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)

Upvotes: 0

Views: 374

Answers (1)

user5022459
user5022459

Reputation:

You can try this piece of code

import urllib2

proxy_support = urllib2.ProxyHandler({"http":"---url of proxy goes here---"})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
urllib2.urlopen(---base-url goes here---).geturl()

Upvotes: 1

Related Questions