feat: implement ustcwlt CLI for USTC WLT login
Setup USTC WLT Python Package ✅
Successfully set up the ustcwlt package with CLI to log in to USTC WLT.
Completed Tasks:
-
Explore repository structure and understand current state -
Bootstrap project (install dependencies, run tests) -
Rename package from python_templatetoustcwlt -
Implement core login functionality -
Update __main__.pyto call CLI function -
Add comprehensive tests for the new functionality -
Verify linting, formatting, and type checking -
Manual testing of CLI functionality -
Code review and security scan (CodeQL) -
Address code review feedback -
Refactor based on PR comments -
Use argparse requiredparameter instead of manual validation -
Replace print statements with logging module -
Move success logging to try-except-else clause
-
Implementation Summary:
python_template → ustcwlt
requests for HTTP requests
-
--username(orUSTCWLT_USERNAMEenv var) - required when env var not set -
--password(orUSTCWLT_PASSWORDenv var) - required when env var not set -
--type(default 0, orUSTCWLT_TYPEenv var) -
--exp(default 0, orUSTCWLT_EXPenv var)
Quality Metrics:
Original prompt
This section details on the original issue you should resolve
<issue_title>Set up the project</issue_title> <issue_description>Set up a Python package named
ustcwlt, which provides a command-line interface to log in to USTC WLT.Traditional way to log in to USTC WLT
#!/bin/sh curl -d "cmd=set&name=${USERNAME}&password=${PASSWORD}&type=${TYPE}&exp=${EXP}" \ http://wlt.ustc.edu.cn/cgi-bin/ipHere,
${TYPE}is set to0~7, meaning the type of the network exit (http://wlt.ustc.edu.cn/link.html). The recommended value is0.${EXP}is the expired time. When it is set to0, it means no expired time.Command line interface
The command-line interface should provide the option for
username,password,type(by default 0), andexp(by default 0). Also, it should allow setting by the environment variablesUSTCWLT_*-- if the value has been set by the environment variable, there is no need to set it in the command-line interface.</issue_description>Comments on the Issue (you are
@copilotin this section)
- Fixes njzjz/ustcwlt#2