69 lines
2.1 KiB
Markdown
69 lines
2.1 KiB
Markdown
|
## bistu_wifi
|
||
|
|
||
|
This project's target is authorize bistu wifi without open a website and try to simplify the login process with a runnable script which can be easily integrated with autostart mechanism.
|
||
|
|
||
|
This project use only standard library of python3, and no other dependency, so there will be nothing annoying like `No module named XXX`. But also take it in mind that it's `python3`, I don't known if it work with `python2`.
|
||
|
|
||
|
## Install
|
||
|
|
||
|
Open the project directory and run
|
||
|
|
||
|
```
|
||
|
pip install .
|
||
|
```
|
||
|
|
||
|
After install, there will be a runnable script `bistu-wifi` at your bin, like `${HOME}/.local/bin` if you install at user level, or `/usr/bin` (or somewhere I don't know) if you install at system level.
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```
|
||
|
bistu-wifi --help
|
||
|
usage: bistu-wifi [-h] [-u [USERNAME]] [-p [PASSWORD]] [--host [HOST]] [-o] [-c [CONFIG]] [--notime]
|
||
|
|
||
|
Login or logout bistu wifi, by sending a post request to authorization host
|
||
|
|
||
|
options:
|
||
|
-h, --help show this help message and exit
|
||
|
-u [USERNAME], --username [USERNAME]
|
||
|
username you use to login bistu wifi
|
||
|
-p [PASSWORD], --password [PASSWORD]
|
||
|
password you use to login bistu wifi
|
||
|
--host [HOST] host to send login/logout request to, default use 10.1.206.13
|
||
|
-o, --logout logout bistu wifi. try to login if not privided
|
||
|
-c [CONFIG], --config [CONFIG]
|
||
|
load info(username, password, host) from config file. Will try /home/leafee98/.config/bistu-wifi/auth.ini if not provided.
|
||
|
--notime don't output time field in log
|
||
|
|
||
|
The format of config file is like below
|
||
|
|
||
|
[DEFAULT]
|
||
|
username = 202000000
|
||
|
password = Bistu000000
|
||
|
host = 10.1.206.13
|
||
|
|
||
|
```
|
||
|
|
||
|
## Debug
|
||
|
|
||
|
Set the environment `BISTU_WIFI_DEBUG` and the script will print some more log.
|
||
|
|
||
|
```
|
||
|
export BISTU_WIFI_DEBUG=1
|
||
|
```
|
||
|
|
||
|
## Develop
|
||
|
|
||
|
Open the project directory and run
|
||
|
|
||
|
```
|
||
|
pip install --editable .
|
||
|
```
|
||
|
|
||
|
Then run the script use `bistu-wifi`. Don't use `python -m bistu_wifi` or `python bistu_wifi/__main__.py` because of relative import.
|
||
|
|
||
|
See more at [python setuptools](https://setuptools.pypa.io/en/latest/userguide/quickstart.html#development-mode).
|
||
|
|
||
|
## License
|
||
|
|
||
|
MIT
|