A rather clunky BUAA campus network automation login script (based on Selenium).
Project description
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())
Project details
Release history Release notifications | RSS feed
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 py_buaa_login-0.1.10.tar.gz.
File metadata
- Download URL: py_buaa_login-0.1.10.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.13.12 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6735340d1b99307b7dc693275d5946901ba2d7e9b83726c835cd9f37d48d863c
|
|
| MD5 |
0d4e145225668d0f22d563982ae21541
|
|
| BLAKE2b-256 |
832cfd29f070ab4da1c6fe00e99061155822f9a01f7290112c9667d49ce8c0a1
|
File details
Details for the file py_buaa_login-0.1.10-py3-none-any.whl.
File metadata
- Download URL: py_buaa_login-0.1.10-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.13.12 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64a104abb4450be6d7f9162911384e371c6c72641848ae26f3fe6c3b206fc7fb
|
|
| MD5 |
d307da65aca8c066f5f91bbddd418b9d
|
|
| BLAKE2b-256 |
f28306d7a514d32ef4d9460df4b2304bfa158d9bb4624ba6ef0a9d0117403d2b
|