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
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":
ImportingSwitching schools
Whenever mbpy starts up, it uses the indicated configuration file, whose contents include the API token given for mbpy config new
.
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
.
Last updated
Was this helpful?