A library that can operate srun network
Project description
SrunTool
深澜校园网操作类
支持
- 登录
- 退出
- 查询当前用户信息
- 查询当前用户姓名
安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple sruntool
使用
from sruntool.SrunOperator import SrunOperator, get_explain
if __name__ == '__main__':
account = '16612345678' # 账号
so = SrunOperator('192.168.0.170') # 创建operator
r = so.current_info() # 获取当前登录账号信息
if r['error'] == 'ok': # 已登录
print(r['user_name'], '已经在线')
exit(0)
r = so.login(account, '123456') # 登录
if r['ecode'] == 0:
print('登录成功', so.get_name(account))
# 不延时容易造成请求频繁
from time import sleep
sleep(1)
r = so.logout(account)
if r['ecode'] == 0:
print('下线成功')
else:
print('登录失败', get_explain(r['ecode']))
更新日志
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
sruntool-0.1.0.tar.gz
(9.6 kB
view hashes)
Built Distribution
sruntool-0.1.0-py3-none-any.whl
(10.3 kB
view hashes)