Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4081a1016 | ||
|
|
055d68e994 | ||
|
|
817f5a3005 | ||
|
|
32da9dc7c4 | ||
|
|
57066b805f | ||
|
|
32043e701c | ||
|
|
8918e11928 | ||
|
|
0cf4934b60 |
No files matched your search
@@ -0,0 +1,36 @@
|
||||
# This workflow will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
- name: Build package
|
||||
run: python -m build
|
||||
- name: Publish package
|
||||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
@@ -0,0 +1 @@
|
||||
dist
|
||||
Generated
+1
@@ -4,6 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/srunbit" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (srun)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
@@ -25,11 +25,11 @@ Download binary file from GitHub [release page](https://github.com/c-my/srun-cl
|
||||
`srun-bit info`: show account information
|
||||
|
||||
## Note
|
||||
### Binary Version Compile Option
|
||||
* Windows10(python3.9.5): `python -m nuitka src/main.py --onefile --standalone --mingw64`
|
||||
### Latest Binary Version Compile Option
|
||||
* Windows10(python3.9.7): `python -m nuitka src/main.py --onefile --standalone --mingw64`
|
||||
* Ubuntu(python3.9.0): `python -m nuitka --onefile --standalone src/main.py`
|
||||
|
||||
**_Windows binary version NOT work on Windows7_**
|
||||
**_Windows binary version NOT works on Windows7_**
|
||||
|
||||
## Thanks to
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
requests==2.25.1
|
||||
@@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = srun-cli-bit
|
||||
version = 0.1.3
|
||||
version = 0.1.4
|
||||
author = Cai Mingyang
|
||||
author_email = cai.my@outlook.com
|
||||
description = A cli tool for BIT campus network.
|
||||
@@ -13,6 +13,8 @@ classifiers =
|
||||
Operating System :: OS Independent
|
||||
|
||||
[options]
|
||||
install_requires =
|
||||
requests
|
||||
package_dir =
|
||||
= src
|
||||
packages = find:
|
||||
|
||||
@@ -17,7 +17,7 @@ def execute():
|
||||
parser = argparse.ArgumentParser(description='Sign in/out BIT campus network')
|
||||
subparsers = parser.add_subparsers(dest='action')
|
||||
|
||||
login_paraser = subparsers.add_parser('login', help='login to network')
|
||||
login_parser = subparsers.add_parser('login', help='login to network')
|
||||
logout_parser = subparsers.add_parser('logout', help='sign out network')
|
||||
info_parser = subparsers.add_parser('info', help='get account info')
|
||||
|
||||
@@ -34,8 +34,8 @@ def execute():
|
||||
print('Please run config first')
|
||||
else:
|
||||
code = n.login(account)
|
||||
if code == network.LoginCode.SUCCEED:
|
||||
print('Login succeed!')
|
||||
if code == network.LoginCode.SUCCESSFUL:
|
||||
print('Login successful!')
|
||||
elif code == network.LoginCode.ARREARAGE:
|
||||
print('Account in arrear.')
|
||||
elif code == network.LoginCode.ALREADY_ONLINE:
|
||||
@@ -53,8 +53,8 @@ def execute():
|
||||
print('Please run config first')
|
||||
else:
|
||||
code = n.logout(account)
|
||||
if code == network.LogoutCode.SUCCEED:
|
||||
print('Logout succeed!')
|
||||
if code == network.LogoutCode.SUCCESSFUL:
|
||||
print('Logout successful!')
|
||||
elif code == network.LogoutCode.ALREADY_OFFLINE:
|
||||
print('You are not online.')
|
||||
else:
|
||||
@@ -68,6 +68,8 @@ def execute():
|
||||
|
||||
account = model.Account(user, passwd)
|
||||
store.write_account(account)
|
||||
else:
|
||||
parser.print_help()
|
||||
|
||||
|
||||
def _print_info(info: Dict):
|
||||
|
||||
@@ -13,7 +13,7 @@ from srunbit.encrypt import hash
|
||||
|
||||
class LoginCode(Enum):
|
||||
FAILED = 0
|
||||
SUCCEED = 1
|
||||
SUCCESSFUL = 1
|
||||
ALREADY_ONLINE = 2
|
||||
ARREARAGE = 3
|
||||
WRONG_PASSWORD = 4
|
||||
@@ -22,7 +22,7 @@ class LoginCode(Enum):
|
||||
|
||||
class LogoutCode(Enum):
|
||||
FAILED = 0
|
||||
SUCCEED = 1
|
||||
SUCCESSFUL = 1
|
||||
ALREADY_OFFLINE = 2
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class Network:
|
||||
self.__base_url = 'http://10.0.0.55'
|
||||
self.__challenge_url = "/cgi-bin/get_challenge"
|
||||
self.__portal_url = "/cgi-bin/srun_portal"
|
||||
self.__succeed_url = "/cgi-bin/rad_user_info"
|
||||
self.__successful_url = "/cgi-bin/rad_user_info"
|
||||
|
||||
def login(self, account: model.Account) -> LoginCode:
|
||||
try:
|
||||
@@ -77,7 +77,7 @@ class Network:
|
||||
logging.debug(f'login res is not ok, got error_msg: {error_msg}')
|
||||
print(json_obj)
|
||||
return LoginCode.FAILED
|
||||
return LoginCode.SUCCEED
|
||||
return LoginCode.SUCCESSFUL
|
||||
|
||||
def logout(self, account: model.Account) -> LogoutCode:
|
||||
form_logout = model.logout(account.username)
|
||||
@@ -92,11 +92,11 @@ class Network:
|
||||
return LogoutCode.ALREADY_OFFLINE
|
||||
else:
|
||||
return LogoutCode.FAILED
|
||||
return LogoutCode.SUCCEED
|
||||
return LogoutCode.SUCCESSFUL
|
||||
|
||||
def get_info(self) -> Union[Dict, None]:
|
||||
try:
|
||||
json_obj = self._get_json(self.__base_url + self.__succeed_url)
|
||||
json_obj = self._get_json(self.__base_url + self.__successful_url)
|
||||
except Exception as e:
|
||||
logging.debug(f'get info failed: {e}')
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user