H
harryos
hi
I am trying to write a program to read data from a site url.
The program must read the data from site every 5 minutes.
def get_data_from_site(pageurlstr):
h=urllib.urlopen(pageurlstr)
data=h.read()
process_data(data)
At first, I thought of using the sched module ,but then it doesn't
look right adding so many scheduler.enter() statements.The program is
supposed to execute the above function every
5 minutes until the application is shut down by the user.
I created an infinite loop
while True:
print time.asctime()
get_data_from_site('http://somesite.com/')
time.sleep(300)
Is there a better way to do this?Any suggestions ,pointers most
welcome
thanks
harry
I am trying to write a program to read data from a site url.
The program must read the data from site every 5 minutes.
def get_data_from_site(pageurlstr):
h=urllib.urlopen(pageurlstr)
data=h.read()
process_data(data)
At first, I thought of using the sched module ,but then it doesn't
look right adding so many scheduler.enter() statements.The program is
supposed to execute the above function every
5 minutes until the application is shut down by the user.
I created an infinite loop
while True:
print time.asctime()
get_data_from_site('http://somesite.com/')
time.sleep(300)
Is there a better way to do this?Any suggestions ,pointers most
welcome
thanks
harry