Python library

The thrustlab package lets you use ThrustLab from your own Python scripts. You can search the parts catalogue, run simulations and read the results.

It takes care of the fiddly parts of talking to the API. It tries a request again when the network drops, works through long lists page by page, and can wait for a simulation to finish.

Install it

bash
pip install thrustlab

You need Python 3.10 or newer.

Make your first call

You need an API key. Create one on the API keys tab of your Account page, then put it in the THRUSTLAB_API_KEY environment variable. The library reads it from there.

python
from thrustlab import Client

client = Client()

motors = client.components.list(type="motor", limit=5)
for motor in motors.data:
    print(motor["name"])

This prints the names of five motors from the catalogue. To go through the whole catalogue, loop over motors itself instead of motors.data. The library fetches the next page each time it needs one.

What you can do with it

What you can do with it
To do thisUse
Find motors, propellers and batteriesclient.components
Run a test bench simulation at one throttleclient.simulations
Run it over a range of throttles or other inputsclient.sweeps
Fly a drone through a schedule over timeclient.flights
Keep runs together in projectsclient.projects
Send in a part that's missing from the catalogueclient.submissions
See how many compute units you have leftclient.compute_units
Get a message when a run finishesclient.webhook_endpoints

Each of these has its own page in this tab.

When something goes wrong

A failed request raises an exception. It has a code that says what went wrong and a request_id. Error handling lists the codes.

If you need help, email [email protected] with the request_id. The source code is in the thrustlab-sdk repository, and you can report problems there too.