Reputation: 21
I'm doing a tweepy crawling. I want the program to run automatically every 12 hours Could you tell me the syntax? I'm doing it with Python, and I have all the tweepy crawling code.
Upvotes: 2
Views: 69
Reputation: 501
You can use "schedule" library
to install, on terminal enter:
pip install schedule
here is an example of the code you want:
#!/usr/bin/python
import schedule
import time
def job():
print("I am doing this job!")
schedule.every(12).hours.do(job)
while True:
schedule.run_pending()
time.sleep(1)
or you can read the documents to see the other functions Click Here
good luck!
Upvotes: 0
Reputation: 1321
You can try executing/calling your program by the command line interface and schedule a task using the embedded in windows- Windows Scheduler. There are many alternatives but that is the easiest I found when I did such task few months ago.
Upvotes: 1