Tools for Web Learning of Tsinghua University.
pip install thulearn2018
Or install the lastest version from GitHub:
pip install git+https://github.com/euxcet/thulearn2018.git
After installing the package, you will get the command learn
. Check this by running
learn --help
This will show all the subcommands you can use basically, including downloading all the new files, listing the deadlines and submitting your work.
For login authentication, please run
learn reset
to set or reset your personal configuration, including the username/password for web learning and the absolute path where you want to save your courses in the current semester. If you'd like to download from past semesters, always remember to customize the target directory unless the default one is preferred.
Notice: The username/password is saved to a local file in your temp directory, depending on your OS and won't be uploaded to anywhere online except the web learning.
Anytime you want to check the config, just run
learn config
Now you could
-
download all the new files and assignments along with the attachments by
learn download [-i | --ignore "<course_name1>[, <course_name2>, ...]"] [-s | --semester <semester>] [-o | --path <path>] [--download-submission]
This command will also create subdirectories for all the courses automatically.
[-i | --ignore ]
: Courses to be ignored, separated by,
, default to none.[-s | --semester ]
: The semester to download, default to the current one.[-o | --path ]
: The path to save the files, default to the one in the config.[--download-submission]
: Whether to download the submissions of assignments, default toFalse
, as it will cover the original work. (Most likely a newer one!). Designed to download from past semesters, when you don't have a copy of your assignments locally.
There are 4 possible annexes for an assignment, including 1. the requirement, 2. the answer, 3. your submission and 4. reviewed submission. As we cannot control how the teacher names the files, prefixes answer_
and reviewed_
will be added to relevant files to avoid clashes.
-
list the deadlines sorted by time
learn ddl [-i | --ignore "<course_name1>[, <course_name2>, ...]"] [-s | --semester <semester>]
-
submit your assignment and the text message with
learn submit /path/to/your/assignment [-m "<message>"]
Notice: This command must be excuted at the assignment directory where a file named
.xszyid
exists. If you do not want to upload any text/file, just omit the-m
option/the parameter followingsubmit
. -
clear all the record of your course files and assignments for a semester, default to the current one.
learn clear [--semester <semester>]
This command will not delete the existing files. It means the next time you try to download course files, all the files will be redownloaded, no matter whether you have downloaded them.
You can interrupt the download process of any certain file to skip it by pressing Ctrl + C
. This skip will be recorded and the next time you try to download the files, the skipped files will not be downloaded again. Used to skip large files like recordings and should be used with caution.
✔️ Use this package
✔️ Report any bug
✔️ Come up with any new idea or feature
✔️ Create your pull request to this repository