-
Notifications
You must be signed in to change notification settings - Fork 1
/
clock.py
45 lines (36 loc) · 1.57 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
from subprocess import call
from apscheduler.schedulers.blocking import BlockingScheduler
from pytz import timezone
sched = BlockingScheduler()
central = timezone('US/Central')
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsWashingtonPost():
call(["python3", "manage.py", "NewsScraper", "--url",
"https://www.washingtonpost.com/",
"--news", "WashingtonPost"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsCNN():
call(["python3", "manage.py", "NewsScraper", "--url", "https://www.cnn.com/",
"--news", "CNN"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsHuffingtonPost():
call(["python3", "manage.py", "NewsScraper", "--url",
"https://www.huffingtonpost.com/",
"--news", "HuffingtonPost"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsNPRPost():
call(["python3", "manage.py", "NewsScraper", "--url",
"https://www.npr.org/sections/politics/", "--news", "NPR"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsFox():
call(["python3", "manage.py", "NewsScraper", "--url",
"http://www.foxnews.com/", "--news", "FoxNews"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsBloomberg():
call(["python3", "manage.py", "NewsScraper", "--url",
"https://www.bloomberg.com/", "--news", "Bloomberg"])
@sched.scheduled_job('cron', hour=7, timezone=central)
def ScrapeNewsBloomberg():
call(["python3", "manage.py", "NewsScraper", "--url",
"https://www.nytimes.com/", "--news", "NYT"])
sched.start()