-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclock.py
33 lines (21 loc) · 834 Bytes
/
clock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from apscheduler.schedulers.blocking import BlockingScheduler
import urllib.request
from services import linenotifyservice
sched = BlockingScheduler()
# @sched.scheduled_job('cron', day_of_week='mon-fri', minute='*/20')
@sched.scheduled_job('interval', minutes=25)
def scheduled_job():
url = "http://127.0.0.1:8000"
conn = urllib.request.urlopen(url)
for key, value in conn.getheaders():
print(key, value)
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=18, minute='15')
def scheduled_job():
linenotifyservice.stock5pm()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=8, minute='38')
def scheduled_job():
linenotifyservice.punchIn()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=17, minute='38')
def scheduled_job():
linenotifyservice.punchOut()
sched.start()