Skip to content

更新webpage_login() 适配新的统一认证api#9

Open
zeroHYH wants to merge 2 commits into
SDU-toolhub:mainfrom
zeroHYH:main
Open

更新webpage_login() 适配新的统一认证api#9
zeroHYH wants to merge 2 commits into
SDU-toolhub:mainfrom
zeroHYH:main

Conversation

@zeroHYH

@zeroHYH zeroHYH commented May 14, 2026

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 14, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在更新 webpage_login() 以适配新的统一认证(CAS/device)接口交互方式,并同步重构登录加密(DES)实现以提升性能/可维护性,同时对课表抓取的 BeautifulSoup 用法和项目依赖版本做了更新。

Changes:

  • 重写 uniform_login_des.py:用位运算 + LUT + 缓存替代原先的逐 bit 列表实现的 DES/3DES 风格加密流程。
  • 更新 webpage_login():改用 httpx.Client() 复用会话/cookies,并调整 device 接口参数(m=1/2/3)与提交登录表单逻辑。
  • findAll() 替换为 find_all(),并升级 httpx/bs4/pandas/sqlmodel 依赖下限。

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
src/login/uniform_login_des.py 重构 DES 加密实现(LUT + 缓存)以支撑新的统一认证加密/性能需求。
src/login/main.py 调整网页登录与设备校验流程,适配新的统一认证 device/login 参数与会话管理。
src/bkzhjx_login.py 将 BeautifulSoup 旧 API findAll 更新为 find_all
pyproject.toml 提升关键依赖的最低版本要求以匹配新实现/调用方式。
Comments suppressed due to low confidence (1)

src/login/main.py:74

  • Raising SystemError for a missing hidden field is misleading because SystemError is meant for interpreter-level failures. Consider raising a RuntimeError/ValueError (and ideally include status code / a short response snippet) so callers can handle login-page changes appropriately.
        if not match:
            raise SystemError(
                f"Cannot find {field} in login page. Check service URL or login page changes."
            )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/login/main.py
@@ -63,114 +63,162 @@ def webpage_login(
"""
Using webpage to login, powered by execjs, BeautifulSoup4 to parse the html and httpx to send requests.
Comment thread src/login/main.py
Comment on lines +67 to +70
match = re.search(
rf'(?:name|id)=[\'\"]{re.escape(field)}[\'\"]\s+value=[\'\"](.*?)[\'\"]',
html,
)
Comment thread src/login/main.py
case "binded" | "pass":
pass
case "bind":
print("2FA:" + device_status_dict.get("m"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants