Python library for accessing the Internet in Peking University.
Project description
libpkuipgw
A library for accessing the Internet through Peking University's Internet service.
Installing
The recommended way is to use pip to install
pip3 install --user libpkuipgw
Usage
First, initialize an IPGWClient
object:
import libpkuipgw
cli = libpkuipgw.IPGWClient(username, password)
To connect to the Internet, call cli.connect()
To check connectivity to the Internet, call cli.check_connectivity()
To disconnect this device, call cli.disconnect()
To disconnect device with specific IP, make the call like cli.disconnect("10.2.111.111")
To disconnect all devices, call cli.disconnect_all()
To get all the connections available: cli.get_connections()
All operations returns IPGWStatus
objects. For example, for get_connections
:
$ res = cli.get_connections()
$ res
libpkuipgw.IPGWStatus(operation="list", status="success", description="", data=[{'ip': '10.2.111.111', 'location': '22楼', 'login_time': '2018-08-08T22:22:22+08'}, {'ip': '10.2.222.222', 'location': '33楼', 'login_time': '2018-08-08T11:11:11+08'}])
The time format is ISO8601 compliant.
If something goes wrong, returns a status of "error".
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
Hashes for libpkuipgw-0.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af0163a68cb0829bcfbf6c12cfe1fc44f8e8cf4e6277eb44cb2259a7fc46303 |
|
MD5 | e0c6c334a254e5e1050d1fe130191467 |
|
BLAKE2b-256 | 70322c3bf62fb3a65c97d73a576e2c6703b481a0a0a8fe529989b75735a02a7b |