Last active
August 29, 2015 14:02
-
-
Save cocal/a2988129186804e891c4 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
''' | |
@author: cocal | |
''' | |
import requests | |
from datetime import datetime | |
from apscheduler.scheduler import Scheduler | |
def tick(): | |
print('Tick! The time is: %s' % datetime.now()) | |
def sc2(): | |
r = requests.get('http://www.karottc.com/') | |
print r.status_code | |
def info(sch = None): | |
sch.print_jobs() | |
if __name__ == '__main__': | |
scheduler = Scheduler(standalone=True) | |
# scheduler2 = Scheduler(standalone=True) | |
# scheduler.add_interval_job(tick, seconds=3) | |
# scheduler2.add_interval_job(sc2,seconds=1) | |
scheduler.add_interval_job(sc2,seconds=5) | |
# scheduler.add_interval_job(info,args=[scheduler],seconds=2) | |
print('Press Ctrl+C to exit') | |
try: | |
# out = '' | |
# scheduler.print_jobs(out); | |
scheduler.start() | |
# scheduler2.start() | |
except (KeyboardInterrupt, SystemExit): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment