Package: welearn-bot-iiserkol
Welearn-botThis is a bot which lets you interact with WeLearn from the command line. It canDownload all files/resources from your courses and organize them in designated folders.Show your assignments, filter due assignments.Add your assignments to Google Calendar.Go to ourproject wikito learn more about configuring and using the script.
Developers may be interested in the article onusing the Moodle Web Service module,
which shows you how to use the accompanyingmoodlews.servicemodule to write your own script for interacting with WeLearn, or indeed any other Moodle service.DemoVideo TutorialWe have aVideo Tutorialmade in association with SlashDot Coding Club which goes over the Installation and Features of Welearn Bot on Windows and Linux.InstallationThis script runs onpython3. To install it on your system, runpip install --upgrade welearn-bot-iiserkolThe--upgradeflag ensures that you get the latest version.If you are on Windows and are new to python, please go through thisquick guide.Running from sourceClone this repo or download the source code, and navigate to that directory. To install dependencies, runpip install -r requirements.txtYou can now navigate to thesrcdirectory and runpython welearn_bot [options ...].ConfigurationOn *nix systems (linux, macos), create a~/.welearnrcfile; on Windows, create awelearn.iniin yourC:/Users/USERNAME/folder.
Inside, fill in your details in the following format.[auth]
username = AzureDiamond
password = hunter2

[courses]
MA1101
PH2202
CH3303
LS4404
ES5505You may omit any or all of your[auth]credentials, in which case you will be prompted each time you run the program.There are many more configuration options to explore, such as the[files]and[gcal]sections - for a detailed breakdown, please consult our
wiki page onwriting your configuration file.Google calendar integrationIntegration with Google Calendar is completely optional. This feature allows you to save your assignment dates directly to Google Calendar, when you use the--gcalendaroption.
You can also choose which calendar within your Google Calendar account to push events to.You will have to authenticate using OAuth2.0 and add some lines to your configuration file.
Please follow the steps in theGoogle Calendar integrationarticle.
At the end, your configuration file will have a section of the following form.[gcal]
client_id = xxxxxxxxxxxxxxx.apps.googleusercontent.com
client_secret = xxxxxxxxxxxxxxxxx
calendar_id = c_xxxxxxxxxxxxxxxxxxxxxxxxxx@group.calendar.google.comUsageRunwelearn_bot -hto get the following help message.usage: welearnbot.py [-h] [--version] [-v] [-d] [-c] [-i [IGNORETYPES ...]] [-r [ROLLS ...]] [-p PATHPREFIX] [-f] [-u] [-m] action [courses ...]

A command line client for interacting with WeLearn.

positional arguments:
  action                choose from
                            files       - downloads files/resources
                            assignments - lists assignments, downloads attachments
                            submissions - lists submission count, 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', 's', 'u', 'c', 'w' are supported.
  courses               IDs of the courses to download files from. The word ALL selects all courses 
                            from [submissions] section in .welearnrc or welearn.ini for 'submissions' action
                            from the [courses] section in .welearnrc or welearn.ini for all other action

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v, --verbose         show verbose warnings/errors
  -d, --dueassignments  show only due assignments with the 'assignments' action
  -c, --gcalendar       add due assignments to Google Calendar with the 'assignments' action
  -i [IGNORETYPES ...], --ignoretypes [IGNORETYPES ...]
                        ignores the specified extensions when downloading, overrides .welearnrc
  -r [ROLLS ...], --rolls [ROLLS ...]
                        roll numbers for which you want to download the submissions using the 'submissions' action
  -p PATHPREFIX, --pathprefix PATHPREFIX
                        save the downloads to a custom path, overrides .welearnrc
  -f, --forcedownload   force download files even if already downloaded/ignored
  -u, --update-course-cache
                        update course cache. Use this class when you change [submissions] section of config
  -m, --missingdownload
                        re-download those files which were downloaded earlier but deleted/moved from their locationSee our article onusing command line optionsfor a detailed breakdown.ExamplesTesting your setupIf your.welearnrcorwelearn.inifile is set up correctly, the following command should simply display your name.welearn_bot whoamiTo get a list of courses you are enrolled in, runwelearn_bot coursesBasic commandsTo pull all files from the courses MA1101 and CH3303, runwelearn_bot files MA1101 CH3303You can use the shorthandfforfiles, so the following is an equivalent command.welearn_bot f MA1101 CH3303To show assignments and download their attachments from the course MA1101, runwelearn_bot assignments MA1101To list due assignments (due date in the future) from all courses, runwelearn_bot -d assignments ALLMake sure that the-dflag comes first!To list all urls from the CH3303 course, runwelearn_bot urls CH3303Calendar integrationTo list due assignments from all courses, and add them to your calendar, runwelearn_bot -dc assignments ALLIgnoring filetypesTo download all resources from the course CH3303, ignoring pdf files, runwelearn_bot -i pdf -- files CH3303Note the use of--which is essential for separating theIGNORETYPESfrom thecourses. The following format may be preferred.welearn_bot files CH3303 -i pdfTo override the.welearnrcignore settings and allow all extensions, but still respect past downloads, runwelearn_bot -i -- files CH3303Force downloads and pathprefixTo 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~/notesfolder, runwelearn_bot files PH2202 -fp ~/notesMissing downloadsIf you've usedwelearn_botto download some files, say fromMA1101, but have subsequently deleted or moved them from the download location,
they willnotbe downloaded again if you simply runwelearn_bot files MA1101Instead, you will see a message calling these filesMissing. To download these files again, runwelearn_bot -m files MA1101Features for TAsNotable featuresThe assignments for each subject are downloaded into it's ownsubmissionsfolder.Each student has it's own folder for each assignment.If the assignment are in archived form (compressed), they are automatically uncompressed.Config changesThe users will have to add a[submissions]section to their config with the appropriate information (as shown below)[submissions]
CS1103 = ALL
CS1101 = 21MS020, ... , 21MS120
CS1102 = 21MS120,  21MS121,  21MS122,  21MS123,  21MS124,  21MS125,  21MS126
CS1101 = 20MS011,  19MS112, 21MS020, ... , 21MS120Notethat you have to add key value pairs of courseid and the roll numbers for which to fetch the submissions
The roll numbers can be entered in the following form:ALLto fetch all submissionsa range of roll numbersa explicit list of roll numbesa mix of range and explicit roll numbersCLI argumentsAn additional action,s (submissions)has been exposed to the users for using this featureThe users can also specify list of roll numbers from the cli using-r (--rolls)optionCLI arguments override the config settingsThe users can update the cache using the-uflag. Use this class when you change[submissions]section of config