feat: 加選課程查詢
This commit is contained in:
parent
5dc8bd559a
commit
d720c32545
@ -89,5 +89,13 @@ if ncnu.status:
|
|||||||
print(log)
|
print(log)
|
||||||
else:
|
else:
|
||||||
print("沒有任何獎懲紀錄")
|
print("沒有任何獎懲紀錄")
|
||||||
|
space()
|
||||||
|
|
||||||
|
# ===== Test 取得加選課程狀態 =====
|
||||||
|
logs = ncnu.getAddCourseLogs()
|
||||||
|
if logs:
|
||||||
|
for log in logs:
|
||||||
|
print(log)
|
||||||
|
space()
|
||||||
else:
|
else:
|
||||||
print("NCNU 教務系統登入失敗")
|
print("NCNU 教務系統登入失敗")
|
||||||
|
|||||||
15
api/ncnu.py
15
api/ncnu.py
@ -152,4 +152,19 @@ class NCNU():
|
|||||||
'award': data[2],
|
'award': data[2],
|
||||||
'count': data[3],
|
'count': data[3],
|
||||||
'content': data[4],
|
'content': data[4],
|
||||||
|
} for data in (data.replace('"', '').split(',') for data in datas)]
|
||||||
|
|
||||||
|
def getAddCourseLogs(self):
|
||||||
|
response = self.session.get('https://ccweb.ncnu.edu.tw/student/applyaddcourselist.php?export=csv')
|
||||||
|
datas = response.text.split('\r\n')[1:-1]
|
||||||
|
|
||||||
|
if len(datas) == 2:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return [{
|
||||||
|
'id': data[0],
|
||||||
|
'semester': data[1],
|
||||||
|
'classname': data[2]+data[3],
|
||||||
|
'class': data[4],
|
||||||
|
'check': data[5],
|
||||||
} for data in (data.replace('"', '').split(',') for data in datas)]
|
} for data in (data.replace('"', '').split(',') for data in datas)]
|
||||||
Loading…
Reference in New Issue
Block a user