Skip to main content

py_buaa_login

一个十分笨重的(基于 selenium)北航校园网自动化登录脚本。

安装方式

[!IMPORTANT]

  • 请使用 pypi 官方软件源,此包 通常无法 从 pypi 非官方镜像源下载。

  • 请使用 python>=3.13

pip install py_buaa_login

使用方式

初次测试

在使用此脚本登录校园网前,脚本初次运行可能会从外网下载 ChromeDrive。因此建议在有外网的环境下进行初次运行测试,测试内容为:

python -m py_buaa_login test "https://www.google.com"

如果程序输出 Test successfully. 则说明 selenium 中的 ChromeDrive 可用。

[!NOTE] 如果你的电脑有图形界面,并且你想要测试 selenium 的 ChromeDrive 图形显示是否正确,可以带 --head 参数进行测试,可以弹出图形用户界面的网页则说明图形用户界面显示正常。

登录校园网

[!NOTE] 登录校园网以及登出校园网时,可能需要等待大概 10 秒,属正常现象。

[!IMPORTANT] 执行校园网登录前,需要关闭系统代理以免 https://gw.buaa.edu.cn 无法正常访问

# 从命令行参数获得用户名和口令
python -m py_buaa_login login "<username>" "<password>"

# 从标准输入或者文件获取用户名和口令
# 第一行内容将被作为用户名
# 第二行内容将被作为口令
python -m py_buaa_login login --stdin

登出校园网

[!IMPORTANT] 执行校园网登出前,需要关闭系统代理以免 https://gw.buaa.edu.cn 无法正常访问

python -m py_buaa_login logout

查询网络是否可用

[!NOTE] 查询网络是否可用时,可能需要等待大概 10 秒,属正常现象。

python -m py_buaa_login status

显示使用指南

python -m py_buaa_login --help
python -m py_buaa_login

编程接口

# 在确定有外网的前提下检查 selenium ChromeDrive 是否可用
# 返回 True 表示 selenium ChromeDrive 可用
from py_buaa_login import test
print(test(True, "https://www.google.com"))

# 检查登录情况
# 返回 True 表示网络可用
from py_buaa_login import login_check
print(login_check())

# 试图登录校园网
# 返回 True 表示登录成功
from py_buaa_login import login
print(login(username, password))

# 试图退出登陆校园网
# 返回 True 表示退出登录成功
from py_buaa_login import logout
print(logout())

Metadata

Release files for py-buaa-login 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-buaa-login 0.1.10
File Size Uploaded
py_buaa_login-0.1.10.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-buaa-login 0.1.10
File Interpreter ABI Platform
py_buaa_login-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / py_buaa_login-0.1.10.tar.gz

Download URL py_buaa_login-0.1.10.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6735340d1b99307b7dc693275d5946901ba2d7e9b83726c835cd9f37d48d863c
BLAKE2b-256 checksum
How to use checksums
832cfd29f070ab4da1c6fe00e99061155822f9a01f7290112c9667d49ce8c0a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.13.12 Windows/11

Release files / py_buaa_login-0.1.10-py3-none-any.whl

Download URL py_buaa_login-0.1.10-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64a104abb4450be6d7f9162911384e371c6c72641848ae26f3fe6c3b206fc7fb
BLAKE2b-256 checksum
How to use checksums
f28306d7a514d32ef4d9460df4b2304bfa158d9bb4624ba6ef0a9d0117403d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.13.12 Windows/11

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page