A command line client for WeLearn, in the IISER Kolkata domain
Project description
Welearn-bot
This is a bot which lets you interact with WeLearn from the command line. It can
- Download all files/resources from your courses and organize them in designated folders.
- Show your assignments, filter due assignments.
Using the Moodle Web Services API makes welearn_bot
fast and robust.
Demo
Installation
This script runs on python3
. To install it on your system, run
pip3 install welearn-bot-iiserkol
Configuration
On *nix systems (linux, macos), create a ~/.welearnrc
file; on windows, create a welearn.ini
in your C:/Users/USERNAME/
folder.
Inside, fill in your details in the following format.
[auth]
username = AzureDiamond
password = hunter2
[courses]
MA1101
PH2202
CH3303
LS4404
ES5505
[files]
ignore = mp4,mkv
pathprefix = ~/welearn
The ALL
keyword will act as shorthand for the course names present in the [courses]
section.
This way, you can choose to omit redundant courses in this section.
The [files]
section lets you specify settings about the organization of your files.
All files with extensions listed in the ignore
option will be not be downloaded.
This is useful for ignoring typically large files such as video files.
This setting is overridden by the --ignoretypes
command line option, which in turn is overridden by the --forcedownload
flag
The pathprefix
is used to specify a common path for storing all your WeLearn course directories, which in turn store
your resources and assignment files.
This is overriden by the --pathprefix
command line option.
Usage
Run welearn_bot -h
to get the following help message.
usage: welearn_bot [-h] [-d] [-i [IGNORETYPES ...]] [-f] [-p PATHPREFIX] action [courses ...]
A command line client for interacting with WeLearn.
positional arguments:
action choose from
files - downloads files/resources
assignments - lists assignments, downloads attachments
urls - lists urls
courses - lists enrolled courses
whoami - shows the user's name and exits
Abbreviations such as any one of 'f', 'a', 'u', 'c', 'w' are supported.
courses IDs of the courses to download files from. The word ALL selects everything from the [courses] section in .welearnrc or welearn.ini
optional arguments:
-h, --help show this help message and exit
-d, --dueassignments show only due assignments with the 'assignments' action
-i [IGNORETYPES ...], --ignoretypes [IGNORETYPES ...]
ignores the specified extensions when downloading, overrides .welearnrc
-f, --forcedownload force download files even if already downloaded/ignored
-p PATHPREFIX, --pathprefix PATHPREFIX
save the downloads to a custom path, overrides .welearnrc
Examples
Testing your setup
If your .welearnrc
or welearn.ini
file is set up correctly, the following command should simply display your name.
welearn_bot whoami
To get a list of courses you are enrolled in, run
welearn_bot courses
Basic commands
To pull all files from the courses MA1101 and CH3303, run
welearn_bot files MA1101 CH3303
You can use the shorthand f
for files
, so the following is an equivalent command.
welearn_bot f MA1101 CH3303
To show assignments and download their attachments from the course MA1101, run
welearn_bot assignments MA1101
To list due assignments (due date in the future) from all courses, run
welearn_bot -d assignments ALL
Make sure that the -d
flag comes first!
To list all urls from the CH3303 course, run
welearn_bot urls CH3303
Ignoring filetypes
To download all resources from the course CH3303, ignoring pdf files, run
welearn_bot -i pdf -- files CH3303
Note the use of --
which is essential for separating the IGNORETYPES
from the courses
. The following format may be preferred.
welearn_bot files CH3303 -i pdf
To override the .welearnrc
ignore settings and allow all extensions, but still respect past downloads, run
welearn_bot -i -- files CH3303
Force downloads and pathprefix
To force download all resources from the course PH2202, even if already downloaded and present or set to be ignored,
and put all the course directories in the ~/notes
folder, run
welearn_bot files PH2202 -fp ~/notes
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file welearn-bot-iiserkol-1.0.0.tar.gz
.
File metadata
- Download URL: welearn-bot-iiserkol-1.0.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89680b111b49f2d5627e9ac66b8a0779d739d043c2b3259c0a5cb8928dfa08d3 |
|
MD5 | d73088969f923d4269b40da6fe2ddfb3 |
|
BLAKE2b-256 | 83865b8e3baf4af86ae32dff17ddbfb37249ed7c3bdcf4b3f0afa8ac77bac584 |
File details
Details for the file welearn_bot_iiserkol-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: welearn_bot_iiserkol-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56287eadeb0266da782447ddd640b29b44823563057bfd02b8b62baa65128144 |
|
MD5 | 5ec4b775bb2824a93a1473c4c6caf698 |
|
BLAKE2b-256 | d94668b2d007170f58267971f87611f5c4166797aa14b5c63a17210a8b397e9f |