jiazheng0609 / ncnu-course-alert Goto Github PK
View Code? Open in Web Editor NEW監測暨大課程的選課人數變化
License: MIT License
監測暨大課程的選課人數變化
License: MIT License
前者方法可能會有人在按下訂閱的前一刻剛好有一空缺,使用者也未察覺,而未被提醒到。
後者方法要考慮重複通知頻率 (可能加重我們計算負擔?),以及許多碩博班課一直有空缺的問題。
取得所有課程資料: 20210913_141623
Traceback (most recent call last):
File "fileDiff.py", line 118, in <module>
if bot.prevAns[courseID]['chosen'] != curCourse['chosen']:
KeyError: '5100190'
連續抓了一段時間後似乎會因為 session 過期而有如下回應 (已用 Big5 decode):
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=big5"/>\r\n<title>500 - 內部伺服器錯誤。</title>\r\n<style type="text/css">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:9px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id="header"><h1>伺服器錯誤</h1></div>\r\n<div id="content">\r\n <div class="content-container"><fieldset>\r\n <h2>500 - 內部伺服器錯誤。</h2>\r\n <h3>您要尋找的資源有問題而無法顯示。</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n'
我在 5d57d1e
所提出的方法,是判斷拿到的資料大小比我們平常正常情況下拿到的小太多時,用一個全域變數當做 flag 促使程式流程改變,重新取得 session,但在 c63c6ee 改連結時被刪掉了。
是否需要討論其他 error handling 方法?我是想到或許改用 HTTP status 來判斷。
還有當 response 出錯時,執行流程也要改變,要阻止他進入 parser,不然 BeautifulSoup 會丟 exception。
@snsd0805 你有什麼想法?
我已經發信去問該平台的 Contact Email 了,對方回覆會就我提出需求與該單位組員討論可行性,有後續結果會通知我。
When running using Python 3.8 and latest version of python-telegram-bot, I get:
Traceback (most recent call last):
File "fileDiff.py", line 9, in <module>
from bot import CourseAlertBot
File "/home/pi/NCNU-course-alert/bot.py", line 7, in <module>
updater = Updater(token=config['TG_BOT']['TOKEN'], use_context=True)
TypeError: __init__() got an unexpected keyword argument 'token'
A quick search of error message I found this similar issue:
python-telegram-bot/python-telegram-bot#3504
Suggesting that we should follow this guide to upgrade our code, to be compatible with v20 python-telegram-bot:
https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-20.0
Raspbian GNU/Linux 10 (buster)
$ python -m telegram
python-telegram-bot 20.5
Bot API 6.8
Python 3.8.18 (default, Sep 5 2023, 02:17:07) [GCC 8.3.0]
伺服器產資料的速度會比較快,我們讓伺服器休息的時間就能更長了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.