So I’m trying to do this (access a file on a website, read its contents and perform actions until the content says to exit. The precondition being it has to wait x seconds before accessing the website again; to recheck the contents):
perform = True
while(perform):
data = urllib.urlopen('someurl')
data = data.read()
if(data == '0'):
dosomething()
elif(data == '1'):
#1 signifies to exit the loop
perform = False
else:
time.sleep(10)
However this never seems to work. ‘Someurl’ always has a value. Some Google says that it’s something to do with the sleep function. Please help!
this:
is the minimal test case and as this always works it can’t be a problem with the
time.sleepfunction