Git Product home page Git Product logo

brush's Introduction

Brush

Brush expands upon CanvasAPI, and provides an optional limited CLI. I wrote this for my personal use during my time using Canvas; I will likely never update it.

Configuration

brush.example.config.json contains the following, and represents a valid Brush configuration file:

{
    "student_name": "John Doe",
    "course_map": [
        {
            "id": "00001",
            "aliases": ["calculus i", "calculus", "calc"]
        },
        {
            "id": "00002",
            "aliases": ["principles of macroeconomics", "macroecon"]
        }
    ]
}

To create your own configuration, copy the example configuration to your home directory, under the name .brushrc. Alternatively, set the BRUSH_CONFIG_PATH environment variable to whatever path you want.

cp brush.example.config.json ~/.brushrc

Edit the configuration file to your liking. You should also create a .env file with the following fields, or manually set them as environment variables in your shell:

CANVAS_API_URL=YOUR_CANVAS_URL
CANVAS_API_KEY=YOUR_API_KEY

Running the CLI

The makeshift method I use is as follows:

git clone https://github.com/mzacuna/brush.git
cd brush
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
echo "CANVAS_API_URL=YOUR_CANVAS_URL" >> .env
echo "CANVAS_API_KEY=YOUR_API_KEY" >> .env

Then, I have this alias set up in my .bashrc:

BRUSH="/path/to/brush"
alias brush="$BRUSH/venv/bin/python $BRUSH"

The CLI utility is now ready for use.

brush --help

Library usage

from canvasbrush import Brush

API_URL = "https://example.instructure.com"
API_KEY = "YOUR_API_KEY"

brush = Brush(API_URL, API_KEY)

# The Brush class extends CanvasAPI's Canvas class. You can call its methods:
for course in brush.get_courses():
    print(course)

License

The MIT License. See LICENSE for more.

brush's People

Contributors

mqnr avatar

Stargazers

Andrés Martínez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.