πŸ“Œ
MBPY: Schools Technology
  • About this Resource
  • Installation
    • Requirements
    • Getting Started Local Install
    • Getting Started using Docker
    • Further instructions with Docker
    • Updating with Docker
  • Tutorials
    • Configuration
    • Importing
    • Extracting
    • Streaming
    • Pipelines
    • Scripting
    • Big Query
  • Querying & Tranformations
    • Querying Commands
    • Querying the Database
    • Querying via Script
    • Querying via an SQLite Client
  • Scripts
    • Daily Homeroom Attendance Report
  • Pipelines
    • Dataframes with pandas
    • Pipelines
    • Example Pipelines
      • Bulk Change Email domain
      • Enrollment by Gender
  • Plugins
    • mbpy_powerschool_plugin
      • PowerSchool Plugin
        • API reference
      • mbpy Plugin
        • mbpy plugin source code
    • Plugins Overview
    • mbpy_plugin_example
    • mbpy_plugin_destiny
    • mbpy_plugin_attendance_reports
Powered by GitBook
On this page
  • Getting Started
  • Switching schools

Was this helpful?

Export as PDF
  1. Tutorials

Configuration

Use configuration to set up API keys for a school (or multiple schools)

Getting Started

After installation, the next step is to enable mbpy to use a school's API key. In ManageBac, create a token with at least read permissions for all endpoints, and copy the token value. Then:

mbpy config new

Does it say command not found? If you just installed it, you'll need to open a new terminal window.

You will then be promopted to enter the subdomain, and the token.

When complete, enter the following:

mbpy config show

The above command reports all configuration information:

                               mbpy configuration
                             β•·
  name                       β”‚ value
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
  subdomain                  β”‚ demo
╢────────────────────────────┼──────────────────────────────────────────────────╴
  token (last 4 digits)      β”‚ daa0
╢────────────────────────────┼──────────────────────────────────────────────────╴
  Root Directory             β”‚ ~/some/path/here
╢────────────────────────────┼──────────────────────────────────────────────────╴
  Scripts Directory          β”‚ ~/some/path/here/mbpy/scripts
╢────────────────────────────┼──────────────────────────────────────────────────╴
  Path to config file        β”‚ ~/some/path/here/mbpy/conf/demo.py
╢────────────────────────────┼──────────────────────────────────────────────────╴
  Path to database           β”‚ ~/some/path/here/mbpy/data/demo.db
╢────────────────────────────┼──────────────────────────────────────────────────╴

Configuration complete! Learn how to pull data from the API by heading over to "Importing":

Switching schools

Whenever mbpy starts up, it uses the indicated configuration file, whose contents include the API token given for mbpy config new.

Security note: The API token is stored in plain text in the configuration file. Access to this file should be restricted.

If you set up more than one school, and need to switch schools, you can use the following command:

mbpy config use subdomain

That will tell mbpy to use the configuration file associated with the subdomain name you previously input.

To see a list of all subdomains available:

mbpy config list

Expliciit configuration

The above demonstrates how to use "implicit" configuration, where mbpy config use selects the subdomain, and then every subsequent mbpy command uses that configuration (until mbpy config use is invoked).

If you would prefer to explicitly indicate which subdoman, you can set the MBPY_SUBDOMAIN variable:

mbpy --subdomain abc …

That will instruct mbpy to use the configuration file, the same as if you first did mbpy config use abc.

PreviousUpdating with DockerNextImporting

Last updated 1 year ago

Was this helpful?

Importing