I am using json.load to make an API request. I'd like to automate it so that it makes the request on the first second of every minute starting at 9:30am and ending at 4pm, ie. 9:30:01am, 9:31:01am ... 4:30:01pm and then stop.
Asked
Active
Viewed 518 times
1 Answers
1
There a few different ways todo this but this is probably the easiest to understand, will have to dowbload the pip package first:
pip install schedule
This is modified from their sample program:
import schedule
import time
def job(t):
print "I'm working...", t
return
schedule.every().day.at("01:00").do(job,'It is 01:00')
while True:
schedule.run_pending()
time.sleep(60) # wait one minute

Hazzah
- 85
- 6