{"id":13673200,"url":"https://github.com/leVirve/iLms-nthu-API","last_synced_at":"2025-04-28T09:30:29.684Z","repository":{"id":62570484,"uuid":"68367501","full_name":"leVirve/iLms-nthu-API","owner":"leVirve","description":"專為 學生 / 助教 / 開發者 所寫的 iLMS 通用 API/command-line 環境。An iLMS client for stduents, assistants and developers.","archived":false,"fork":false,"pushed_at":"2018-06-08T05:39:07.000Z","size":92,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T19:50:44.226Z","etag":null,"topics":["api","client","interface","nthu","parser","spider","system"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leVirve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-16T09:23:51.000Z","updated_at":"2023-12-04T12:14:48.000Z","dependencies_parsed_at":"2022-11-03T17:15:47.526Z","dependency_job_id":null,"html_url":"https://github.com/leVirve/iLms-nthu-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leVirve%2FiLms-nthu-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leVirve%2FiLms-nthu-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leVirve%2FiLms-nthu-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leVirve%2FiLms-nthu-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leVirve","download_url":"https://codeload.github.com/leVirve/iLms-nthu-API/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251284836,"owners_count":21564674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","interface","nthu","parser","spider","system"],"created_at":"2024-08-02T10:00:30.635Z","updated_at":"2025-04-28T09:30:27.903Z","avatar_url":"https://github.com/leVirve.png","language":"Python","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# iLMS NTHU\n\n專為 學生/助教/開發者 所寫的 iLMS 通用 API/command-line 環境\n\n- 列出 修課課程 / 作業 / 上課教材\n- 下載 作業 / 上課教材\n- 上傳 `csv` 檔登記作業分數\n\n## 安裝\n\n- 從 `PyPI` 上安裝\n    ```bash\n    pip install -U ilms-nthu\n    ```\n- 從本專案原始碼安裝最新版\n    ```bash\n    pip install git+https://github.com/leVirve/iLms-nthu-API\n    ```\n\nNote: 本專案開發測試在 Python3.5+\n\n## 指令\n\n### 列出 修課課程 / 作業 / 上課教材\n\n- 列出本學期所有課程\n    ```bash\n    ilms view course\n    ```\n\n- 列出所有修過課程\n    ```bash\n    ilms view course --semester_id all\n    ```\n\n- 列出某學期修過課程, e.g.\n    ```bash\n    ilms view course --semester_id 1051\n    ```\n\n- 列出某課程所有作業, e.g.\n    ```bash\n    # 只需輸入 課號 (course id)/課程中英文 關鍵字\n    ilms view homework --course CS65500\n    ilms view homework --course Vision\n    ilms view homework --course 電腦視覺\n    ```\n\n- 完整指令\n    ```bash\n    Usage: ilms view [OPTIONS] 查詢項目\n\n    選擇查詢項目 課程 / 作業 / 上課教材 ['course', 'homework', 'material']\n\n    Options:\n        --semester_id TEXT  學期\n        --course TEXT       課程關鍵字\n        --verbose           顯示詳細資訊\n        --help              Show this message and exit.\n    ```\n\n### 下載 作業 / 上課教材\n\n- 下載所有上課教材, e.g.\n\n    ```bash\n    # 只需輸入 課號 (course id)/課程中英文 關鍵字\n    ilms download material --course 35700\n    ilms download material --course 多媒體\n    ilms download material --course Visual Effects\n    ```\n\n- [助教模式 TA mode] 下載所有學生作業, e.g.\n\n    ```bash\n    # --course 課號 (course id)/課程中英文 關鍵字\n    # --hw_title 作業標題 關鍵字\n    ilms download handin --course CS35700 --hw_title Homework1\n    ```\n\n- 完整指令\n    ```bash\n    Usage: ilms download [OPTIONS] 下載項目\n\n    選擇下載項目 上課教材 / 繳交作業 (助教) ['material', 'handin']\n\n    Options:\n        --course TEXT     課程關鍵字\n        --hw_title TEXT   作業標題\n        --folder TEXT     下載至...資料夾\n        --help            Show this message and exit.\n    ```\n\n### 登記成績\n\n- [助教模式 TA mode] 透過上傳分數 `csv` 檔登記分數, e.g.\n\n    ```bash\n    # --course 課號 (course id)/課程中英文 關鍵字\n    # --hw_title 作業標題 關鍵字\n    ilms score --course CS35700 --hw_title Homework1 --score_csv hw1-cs3570.csv\n    ```\n\n- 完整指令\n    ```bash\n    Usage: ilms score [OPTIONS]\n\n    Options:\n        --course TEXT     課程關鍵字\n        --hw_title TEXT   作業標題\n        --csv TEXT        CSV 成績表\n        --help            Show this message and exit.\n    ```\n\n### 登出 iLMS-NTHU API\n\n```bash\nilms logout\n```\n\n## 範例程式 API Demo\n\n### 登入 iLms\n\n- You need login for any operations that need privileges.\n- login with helper function `get_account()`\n\n```python\nfrom ilms.core import User\nfrom ilms.core import Core as iLms\nfrom ilms.utils import get_account\n\nuser = User(*get_account())\nassert user.login()\n\n# You can take your profile\nprofile = ilms.get_profile()\n\nilms = iLms(user)\n```\n\n### 查詢/搜尋課程\n\n```python\n# iterate through courses with loop\nfor cou in ilms.get_courses():\n    cou.course_id\n    print(cou)\n\n# query with 'keyword', can be coures_id or partial course name in `en` or `zh`\ncourses = ilms.get_courses()\ncou = courses.find(course_id='CS35700')\ncou = courses.find(name='視覺特效')\ncou = courses.find(name='Pattern Recog')\n\n```\n\n### 下載所有上課教材\n\n```python\nfor material in cou.get_materials():\n    print(material)\n    material.download(root_folder='download/cvfx/')\n```\n\n### 下載所有繳交作業檔案\n\n```python\nfrom ilms.utils import load_score_csv\n\nhomeworks = cou.get_homeworks()\nhw1 = homeworks.find(title='Homework1')\n\nhw1.download_handins()\n```\n\n### 為作業登記分數\n\n- Use helper function `load_score_csv()` to load the scores in csv file (contains only two columns, `student id` and `score`)\n- Can do some processes on the `score_map`, and then use `score_hanins` method to grading in bulk.\n\n```python\nfrom ilms.utils import load_score_csv\n\nhomeworks = cou.get_homeworks()\nhw1 = homeworks.find(title='Homework1')\n\nscore_map = load_score_csv('hw1-cs35700.csv')\nscore_map = {\n    student_id: math.ceil(score)\n    for student_id, score in score_map.items()}\n\nhw1.score_handins(score_map)\n```\n\n### 完整範例\n\n```python\nfrom ilms.core import User\nfrom ilms.core import Core as iLms\n\n\n''' 1. get your profile '''\nprofile = ilms.get_profile()\n\n''' 2. iterate through all your courses '''\nfor cou in ilms.get_courses():\n\n    ''' 2.a find out all homewrok information '''\n    for homework in cou.get_homeworks():\n\n        ''' 3. if you're TA, you should get this feature\n               to explore all the students' works !\n               [View the detail / Download files]\n        '''\n        for handin in homework.handin_list:\n            pprint(handin.detail)\n            handin.download()\n\n    ''' 4. You can download all materials in few lines ! '''\n    for material in cou.get_materials():\n        print(material.detail)\n        material.download()\n\n    print(cou.get_forum_list().result)\n```\n\n### 智慧查詢資料結構 Smart query container\n\nEven, with `smart query` feature\n\n```python\n\ncourses = ilms.get_courses()\n\n''' get the specific course with keyword '''\ncourse = courses.find(course_id='CS35700')\n\nhomeworks = course.get_homeworks()\n\n''' get the specific homework (in two ways) '''\nhw1 = homeworks.get(0)\nhw1 = homeworks.find(title='Homework1')\n\n''' get the specific haned_in homework '''\nhandin = hw1.get(87)\nhandin = hw1.handin_list.find(authour='王曉明')\nhandin = hw1.handin_list.find(date='2017-03-25')\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FleVirve%2FiLms-nthu-API","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FleVirve%2FiLms-nthu-API","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FleVirve%2FiLms-nthu-API/lists"}