Brightspace Command Line Interface (bscli) at Radboud University

bscli is a command line interface for Brightspace, developed at Radboud University (but not limited to it). As the name suggests, it provides the ability to download assignment submissions via your command line (which is fast) instead of using the web interface (which is slow). Perhaps other administrative tasks may be implemented as well, in the future.

Additionally, bscli is able to (semi-)automate grading and distribution of homework assignments. It is able to download submissions, process them and distribute them to graders. These graders can then grade the assignments and upload their grades back to Brightspace.

For people familiar with it, bscli replaces the old bsscripts, which provided similar functionality.

Installation

To install bscli, you need to have Python 3.10 or higher installed on your system. You can install bscli using pip:

pip install bscli

We will not go into details about how to install Python, but you can find more information in the Python documentation or in various online tutorials. You may want to use pyenv to manage different Python versions on your system, especially if you have multiple projects that require different Python versions. You may also want to use a virtual environment, but you can also install it globally. We will also not go into details about virtual environments here.

If you want to use bscli for automatically processing homework assignments, you also need to install some additional OS packages:

We will not go into details about how to install these, but you may want to use apt for Ubuntu or brew for macOS.

View on PyPI

Configuration

Before you can use bscli, you need to configure it with your Brightspace instance and FileSender credentials.

Brightspace configuration

To use bscli, you need to configure it with API credentials specific to your Brightspace instance. You should receive these credentials from your Brightspace administrator. You can configure bscli by running the following command:

bscli config init bsapi

This will prompt you for the necessary credentials and save them in a configuration file on your system (by default in ~/.config/bscli/bsapi.json).

Below are the credentials to use with the Radboud University Brightspace instance.

Client ID: ...
Client Secret: ...
LMS URL: brightspace.ru.nl
Redirect URI: https://bscli.science.ru.nl/callback

FileSender configuration

If you want to use bscli for distributing homework assignments to graders, you also need to configure FileSender credentials. FileSender is a service that allows you to send large files securely and bscli is able to upload files to FileSender directly. To configure FileSender, you need to have an account on a FileSender service and obtain the API credentials. You can configure bscli for FileSender by running the following command:

bscli config init filesender

This will prompt you for the necessary credentials and save them in a configuration file (by default in ~/.config/bscli/filesender.json).

You can use the SURF FileSender instance and acquire the credentials via https://filesender.surf.nl/?s=user. You need a username (which can be a random string), email address, and api key (also a long random string).

Authentication

Most commands in bscli require authentication to access Brightspace on your behalf. bscli will prompt you to authenticate when you run a command that requires it. You can also authenticate manually by running the following command:

bscli config authorize

This will open a web browser where you can log in to Brightspace and authorize bscli to access your account. If you have already authenticated, bscli will use the existing authentication token as long as it is valid. This is typically a few hours, depending on your Brightspace instance configuration (this is not controlled by bscli).

Basic usage

bscli is an actual command line interface with subcommands, similar to git or docker. For a list of available commands, you can run:

bscli --help

For example, to list all courses you have access to, you can run:

bscli courses list

To list all assignments in a specific course, you can run:

bscli assignments list --course-id <course_id>

or if you have a course.json file in your current directory (see below), you can simply run:

bscli assignments list

Then, to download all submissions for a specific assignment, you can run:

bscli submissions download --course-id <course_id> --assignment-id <assignment_id>

or if you have a course.json file in your current directory specifying the alias A01 for a specific assignment, you can run:

bscli submissions download A01

Course configuration

Most commands are related to a specific Brightspace course. Though you can specify the course ID explicitly using the --course-id option, it is often more convenient to create a course.json file in your current directory (containing anything related for a specific course, such as aliases for assignments). By default, bscli will look for a course.json file in the current directory and use it for all commands. In this course.json file, you can specify the course ID and other course-specific grading settings for distributing assignments. Typically, one grader coordinator creates this file for a course and shares it with whoever needs it.

You can create a course.json file by running:

bscli courses config-create

This will prompt you for all kinds of course-specific settings and aliases and save them in a course.json You can also edit the file manually. The README of bscli contains more information about the format of this file and the available options.

Distributing assignments

If you want to distribute assignments to graders, you can use the bscli distribute command. This command will:

  1. download all submissions for the specific assignment
  2. process them automatically (e.g., unzip archives, convert .docx files to .pdf files, remove specific files, inject specific files, etc.)
  3. divide the submissions into groups for each grader according to the course configuration
  4. upload the groups to FileSender and send the links to the graders via email

Privacy Notice: For privacy, the submissions should be encrypted with a password before uploading to FileSender. This password can be set in the course configuration file (course.json) for each assignment. Graders will need to input this password to download the submissions from FileSender. This password is not sent via email to the graders (SURF does not allow it), so it needs to be communicated separately (e.g. in person).

If you do not set a password, bscli will not encrypt the submissions and will upload them directly to FileSender. Notice that this is not recommended!

Uploading feedback and grades

If you want to upload feedback and grades back to Brightspace, you can use the bscli feedback upload command. This command will look for a feedback.txt file in the current directory, parse its contents and upload the feedback and grades to Brightspace. A template feedback.txt file will automatically be created when you run the bscli distribute command.