Skip to main content

Python interface to the Mythic Beasts Hosted Pi API

Project description

Latest Version

Python interface to the Mythic Beasts Hosted Pi API, developed by the piwheels team (Ben Nuttall and Dave Jones).

This module provides a Pythonic interface to the API, as well as a command line interface.

The authors of this library are not affiliated with Mythic Beasts, but we use their Pi cloud to power the piwheels project.

Documentation of the API itself can be found at https://www.mythic-beasts.com/support/api/raspberry-pi

Usage

View the information about Pis in your account from the command line:

$ hostedpi ls
pi123
pi234
pi345
pi456
$ hostedpi table
┏━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┓
┃ Name  ┃ Model ┃ Memory ┃ CPU Speed ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━┩
│ pi123 │ 3     │ 1 GB   │ 1.2 GHz   │
│ pi234 │ 3     │ 1 GB   │ 1.2 GHz   │
│ pi345 │ 4     │ 8 GB   │ 2.0 GHz   │
│ pi456 │ 4     │ 4 GB   │ 1.5 GHz   │
└───────┴───────┴────────┴───────────┘
$ hostedpi table pi123
┏━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┓
┃ Name  ┃ Model ┃ Memory ┃ CPU Speed ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━┩
│ pi123 │ 3     │ 1 GB   │ 1.2 GHz   │
└───────┴───────┴────────┴───────────┘

$ hostedpi table pi345 --full
┏━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┓
┃ Name  ┃ Model ┃ Memory ┃ CPU Speed ┃ NIC Speed ┃ Disk size ┃ Status     ┃ Boot Progress ┃ IPv4 SSH port ┃ IPv6 Address       ┃ Location ┃ Power ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━┩
│ pi345 │ 4B    │ 8 GB   │ 2.0 GHz   │ 1 Gbps    │ 50 GB     │ Powered on │ booted        │ 5381          │ 2a00:1098:8:17d::1 │ CLL      │ True  │
└───────┴───────┴────────┴───────────┴───────────┴───────────┴────────────┴───────────────┴───────────────┴────────────────────┴──────────┴───────┘

Provision a new Pi with your public key and SSH into it:

$ hostedpi create mypi --model 3 --ssh-key-path ~/.ssh/id_rsa.pub --wait
┏━━━━━━┳━━━━━━━━━━━━━┓
┃ Name ┃ Status      ┃
┡━━━━━━╇━━━━━━━━━━━━━┩
│ mypi │ Provisioned │
└──────┴─────────────┘
$ hostedpi ssh command mypi
ssh -p 5063 root@ssh.mypi.hostedpi.com
$ ssh -p 5063 root@ssh.mypi.hostedpi.com
root@mypi:~#

Write a Python script to provision a new Pi and output its SSH command:

from hostedpi import PiCloud, Pi4ServerSpec

cloud = PiCloud()

pi = cloud.create_pi(name="mypi", spec=Pi4ServerSpec())
print(pi.ipv4_ssh_command)
  • See the getting_started page for information on how to get API keys and authenticate

  • See the cli/index page for information on using the command line interface

  • See the api/index page for the module’s API reference

Documentation

Documentation for this module can be found at https://hostedpi.readthedocs.io/

Documentation of the API itself can be found at https://www.mythic-beasts.com/support/api/raspberry-pi

Contributing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hostedpi-0.5.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hostedpi-0.5.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file hostedpi-0.5.0.tar.gz.

File metadata

  • Download URL: hostedpi-0.5.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hostedpi-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5b5adce14fc17462ee452d755e7b506e67d335a05f4824b7c05b640c00b1ac75
MD5 32d648e8ae62419bc8c604c7a8ae2a6e
BLAKE2b-256 98e085e9de7e0b0900fcba829e820d946033fb9f886457511ea3cdfb09c84866

See more details on using hashes here.

File details

Details for the file hostedpi-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: hostedpi-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hostedpi-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b10674e2894a87aa44fc1782efa473315c154a77c99116551e587f24ee03064
MD5 117d0deb86fe75e994107d8c88d54e46
BLAKE2b-256 d468fb12e028f7434eb7fa45636c27d4f847b02ff58d3a9393078df6c3bb0e65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page