Getting started
This page contains a simple tutorial to help you get started by creating a Mythic Beasts account, creating an API key, using the command line interface and the Python module.
Create a Mythic Beasts account
Create an API key
Log in to your Mythic Beasts account: https://www.mythic-beasts.com/user/login
Open the API Keys page: https://www.mythic-beasts.com/customer/api-users
Enter a descriptive name for your API key, for your own reference
Check the Raspberry Pi Provisioning box
Click the Create API key button
6. Make a note of the API ID and Secret. You’ll need them to use this Python module, and you can’t retrieve them after this screen is gone.
Note
If you lose your keys, you can simply reset them or create a new API key.
Install the hostedpi module
For a system-wide installation of the CLI only, we recommend you use pipx. See the pipx docs
for more information.
$ pipx install hostedpi[cli]
To install the Python library, you can install into an activated virtual environment:
$ pip install hostedpi
To include the CLI dependencies, you can install the hostedpi[cli] extra:
$ pip install hostedpi[cli]
Set your environment variables
You can either set your API ID and secret in your shell’s config file (e.g. ~/.bashrc or
~/.zshrc), or you can create a .env file in your working directory.
Shell config
Add the following lines to your shell’s config file (e.g. ~/.bashrc or ~/.zshrc):
export HOSTEDPI_ID='YOUR ID'
export HOSTEDPI_SECRET='YOUR SECRET'
Be sure to restart your terminal after setting these.
.env file
Alternatively, you can create a .env file in your working directory with the following:
HOSTEDPI_ID='YOUR ID'
HOSTEDPI_SECRET='YOUR SECRET'
Test your API keys
To test your API connection, try running the following command in a terminal:
$ hostedpi test
Connected to the Mythic Beasts API
This message means your API credentials were found and a successful connection was made.
You may prefer to test by setting your API ID and secret within the test command line:
$ HOSTEDPI_ID='YOUR ID' HOSTEDPI_SECRET='YOUR SECRET' hostedpi test
Connected to the Mythic Beasts API
If you already have Pis in your account, you can list them with:
$ hostedpi list
pi123
pi234
pi345
pi456
You can provision a new Pi with the following command:
$ hostedpi create --model 3 --wait