-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: change from schedule to apscheduler
- Loading branch information
1 parent
4d233b1
commit 59820c9
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import schedule | ||
from apscheduler.schedulers.blocking import BlockingScheduler | ||
from stackernews import StackerNews | ||
|
||
stacker = StackerNews() | ||
schedule.every(10).minutes.do(stacker.run) | ||
|
||
scheduler = BlockingScheduler(timezone='Asia/Hong_Kong') | ||
scheduler.add_job(stacker.run, 'interval', minutes=10, id='stacker') | ||
|
||
|
||
if __name__ == '__main__': | ||
while True: | ||
schedule.run_pending() | ||
scheduler.start() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ urllib3>=1.26.9 | |
sqlalchemy>=1.4.40 | ||
beautifulsoup4>=4.11.1 | ||
PyYAML>=6.0 | ||
schedule>=1.1.0 | ||
apscheduler |