Skip to content

Commit

Permalink
change: change from schedule to apscheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
travislee89 committed Sep 4, 2022
1 parent 4d233b1 commit 59820c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions app.py
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()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ urllib3>=1.26.9
sqlalchemy>=1.4.40
beautifulsoup4>=4.11.1
PyYAML>=6.0
schedule>=1.1.0
apscheduler

0 comments on commit 59820c9

Please sign in to comment.