Created
April 18, 2017 13:20
-
-
Save nenodias/ca4e4e51d16caa46f6bea59ffd02108d to your computer and use it in GitHub Desktop.
Agendando tarefa com Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| schedule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Teste.""" | |
| import sys | |
| import schedule | |
| import threading | |
| import time | |
| def job(): | |
| print("I'm working...") | |
| schedule.every(10).minutes.do(job) | |
| schedule.every().hour.do(job) | |
| schedule.every().day.at("10:18").do(job) | |
| schedule.every().monday.do(job) | |
| schedule.every().wednesday.at("13:15").do(job) | |
| def run(): | |
| while True: | |
| schedule.run_pending() | |
| time.sleep(1) | |
| try: | |
| t = threading.Thread(target=run, args=()) | |
| t.start() | |
| except: | |
| sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment