Code Monkey home page Code Monkey logo

ncnu-course-alert's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ncnu-course-alert's Issues

要以人數變動來通知,還是以剩餘名額 > 0 ?

前者方法可能會有人在按下訂閱的前一刻剛好有一空缺,使用者也未察覺,而未被提醒到。
後者方法要考慮重複通知頻率 (可能加重我們計算負擔?),以及許多碩博班課一直有空缺的問題。

有時候會抓到以前沒有的課號 KeyError

取得所有課程資料: 20210913_141623
Traceback (most recent call last):
  File "fileDiff.py", line 118, in <module>
    if bot.prevAns[courseID]['chosen'] != curCourse['chosen']:
KeyError: '5100190'

有些時候就算有名額,但不一定能選得到課

可以在這個 issue 收集一些例外情形,不知道之後要寫給使用者的說明需不需要有這個注意事項,給人參考?

外文系開設的共同選修 有限制外系修課人數

如下圖,在共同選修看到外文系開設的 日文一(上) 及 德文一(上) 雖然顯示有剩餘名額多於一位,但我身為資工系學生的話,會遇到外文系的「其他系所修課人數上限」,這資訊好像就沒辦法透過我們能爬到的資料判斷。
2021-09-13 13-10-15 的螢幕擷圖

抓了一段時間後有機會撞到 500 - 內部伺服器錯誤

連續抓了一段時間後似乎會因為 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 你有什麼想法?

介接學校 OpenData API

我已經發信去問該平台的 Contact Email 了,對方回覆會就我提出需求與該單位組員討論可行性,有後續結果會通知我。

Incompatible with >=20.0 version of python-telegram-bot

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

Operating System

Raspbian GNU/Linux 10 (buster)

Version of Python, python-telegram-bot & dependencies

$ 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]

改用 HTML parse

伺服器產資料的速度會比較快,我們讓伺服器休息的時間就能更長了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.