A client for NYUST SSO system, providing authenticated access and common API calls.
Project description
NYUST SSO Client
NYUST 單一登入系統 (SSO) 模擬客戶端登入,並取得相關資訊。
⚠️ WARNING:
- 目前還在趕工與測試階段,可能會有不穩定的情況。
- 本模組僅供學術研究使用,請勿用於非法用途。
安裝
pip install nyust-sso-client
使用範例
以下示範使用 ddddocr 處理驗證碼。執行以下指令安裝ddddocr(可選)。
pip install ddddocr
import ddddocr
from nyust_sso import NYUSTSSOClient
if __name__ == "__main__":
ocr = ddddocr.DdddOcr(show_ad=False)
client = NYUSTSSOClient()
captcha = client.fetch_captcha()
captcha_text = ocr.classification(captcha)
client.login("<username>", "<password>", captcha_text.lower())
# 獲取當前學期所有課程資訊
courses = client.fetch_my_courses()
參數說明
NYUSTSSOClient: 模組的核心,用於與 NYUST SSO 系統互動。fetch_captcha(): 抓取登入頁面上的驗證碼圖片。login(username, password, captcha_text): 執行登入動作,需提供使用者名稱、密碼以及辨識後的驗證碼文字。fetch_my_courses(): 登入後,取得當前學期的課程資訊。
驗證碼處理
此範例中使用了 ddddocr 模組來辨識驗證碼。若對驗證碼有其他需求可自行實現替換 ddddocr,此範例只是提供一種破解示範。
注意事項
captcha_text.lower(): 轉換驗證碼文字為小寫,確保與伺服器驗證格式一致。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nyust_sso_client-0.3.0.tar.gz.
File metadata
- Download URL: nyust_sso_client-0.3.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.5 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb183c4cd88a67605f4fe3d49440f86b863329af49df4da9a95cb4f53db459c8
|
|
| MD5 |
bc0534d4e6b0cf39a1f57689840dc477
|
|
| BLAKE2b-256 |
bf7faaf59dc339fbc1309e753a7f5701110dd6e1f87b116a162ff904e4d29008
|
File details
Details for the file nyust_sso_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: nyust_sso_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.5 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5946ae18672bec99d7cdaa4d195891fc34a0967087664d819fb9a37302a958de
|
|
| MD5 |
5bbe3ae1596e9ea0ad6fd4a07d6db50c
|
|
| BLAKE2b-256 |
db59dbfee4629fdc5e7aa103444bb9afe05cd24e601094a8485ebd31c7de2a03
|