android - QPython3 background task fails When screen go off -
i have written program via python witch loads url multiple times , works on pc. when i'm using qpython3 on android launch script, fails when screen off. please me solution. below code:
import urllib.request, time, sys urllib.error import httperror datetime import datetime, date, timedelta ncnt = 0 while ( ncnt < 8192 ) : ncnt = ncnt + 1 try : response = urllib.request.urlopen(my_url) htmlbytes = response.read() response.close() except httperror e : print ('') if e.code == 404 : print ( '404 error [%s]' % (my_url) ) else : print ( 'urlopen error httperror code : %d [%s]' % ( e.code, my_url) ) sys.exit() print (time.strftime('%m/%d %h:%m:%s'), end=' ') time.sleep(600)
Comments
Post a Comment