class
Client
Your HardLabs account, and the boards you can open with it.
from hardlabs_sdk import ClientClient(token=None, api=None, *, timeout=60.0)Client() signs in with the token npx hardlabs login saved on this computer, or HARDLABS_TOKEN when it is set.
Usage
from hardlabs_sdk import Client
client = Client()
board = client.start("hardlabs/demo-board")Arguments
tokenstr | Nonedefault None- An API token. Defaults to
HARDLABS_TOKEN, then the tokenhardlabs loginsaved. apistr | Nonedefault None- The API's address. Defaults to
HARDLABS_API_URL, thenhttps://api.hardlabs.io. timeoutfloatdefault 60.0- Real seconds a single request may take.
Raises
- LookupError — No token was given and none is saved.
Client.memethod
Returns the account the token belongs to.
client.me() -> dictReturns
dict — The account, as the API reports it.
Client.simsmethod
Lists the simulations you can open.
client.sims() -> list[dict]python -m hardlabs_sdk sims prints the same list.
Returns
list[dict] — Each with its address (owner/project@version) and id.
Client.boardmethod
Returns a board by name, without booting it. Call Board.start to boot it.
client.board(name) -> BoardArguments
namestrowner/project@version,owner/project(its latest published version), a project's name, or an id.
Returns
Board — The board.
Raises
- HardLabsError — No simulation has that name, or more than one does. The message lists what you can open.
Client.startmethod
Returns a board by name, booted. The same as board(name).start(firmware).
client.start(name, firmware=None) -> BoardUsage
board = Client().start("company_name/board_name", "build/app.elf")Arguments
namestr- The simulation's name, as
boardtakes it. firmwarestr | Path | Image | list | Nonedefault None- The firmware to boot, as
Board.starttakes it. The board's own when left out.
Returns
Board — The running board.