I try this simple code, but the damn break does not work ... what's wrong?
while True: for proxy in proxylist: try: h = urllib.urlopen(website, proxies = {'http': proxy}).readlines() print 'worked %s' % proxy break except: print 'error %s' % proxy print 'done'
It should leave the time when the connection is working, and go back and try another proxy if it doesnβt
ok that's what i do
I am trying to check the website, and if it has changed, it should exit this time to continue the rest of the script, but when the proxy does not connect, I get an error from the variable, since this is a null value, so I want this worked like a loop to try the proxy server, and if it works, continue the script and end the script, go back and try the next proxy server, and if the next one does not work, it will go back to the beginning to try the third proxy, etc. ...
I'm trying something like this
while True: for proxy in proxylist: try: h = urllib.urlopen(website, proxies = {'http': proxy}) except: print 'error' check_content = h.readlines() h.close() if check_before != '' and check_before != check_content: break check_before = check_content print 'everything the same' print 'changed'
Shady source share