I have this program that check a website, and I want to know how can I check it via proxy in Python…
this is the code, just for example
while True:
try:
h = urllib.urlopen(website)
break
except:
print '['+time.strftime('%Y/%m/%d %H:%M:%S')+'] '+'ERROR. Trying again in a few seconds...'
time.sleep(5)
By default,
urlopenuses the environment variablehttp_proxyto determine which HTTP proxy to use:If you instead want to specify a proxy inside your application, you can give a
proxiesargument tourlopen:Edit: If I understand your comments correctly, you want to try several proxies and print each proxy as you try it. How about something like this?