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     ┃ Initialised keys ┃ IPv4 SSH port ┃ IPv6 Address       ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
│ pi345 │ 4B    │ 8 GB   │ 2.0 GHz   │ 1 Gbps    │ 50 GB     │ Powered on │ Yes              │ 5381          │ 2a00:1098:8:17d::1 │
└───────┴───────┴────────┴───────────┴───────────┴───────────┴────────────┴──────────────────┴───────────────┴────────────────────┘

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.4.6.tar.gz (22.2 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.4.6-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hostedpi-0.4.6.tar.gz
Algorithm Hash digest
SHA256 50dbc10824b10fdfcc7ed480f2af19f887b8931068658f394409e90c55d72c0a
MD5 50223391875de76cdaa687390fd7d975
BLAKE2b-256 5a56c91c249d381c3ca1baa96259c79a7e4fd3aaf82d8678bd9f074a2e911010

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hostedpi-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e8047ee6b873480c60787a83dada8272343fd0e34b6df65f6e5ebfcb1a3e1564
MD5 5c37d23b3170ac1a5d3ce6eb59f69490
BLAKE2b-256 e20ea45c1eaa0674b509379b27c9a4c2212bee9f632f215c2ba68a349214cb1c

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