Users
You can ask ThrustLab who your API key belongs to and what that account is allowed to do. It is a quick way to check that your key works, and to find out whether your plan covers a flight simulation before you start one.
from thrustlab import Client
client = Client()
me = client.users.me()
print(me["email"], me["tier"])client.users.me() is the only method here. It sends one request and returns your profile as a dictionary.
What you get back
| Field | What it holds |
|---|---|
id, email, first_name, last_name | Who you are. |
email_verified | Whether you confirmed your email address. An unverified account can't run simulations. |
tier | Your plan, for example free or pro. |
entitlements | What your plan lets you do. |
concurrency | How many runs you may have going at once, how many are active, and how many are queued. |
unit_system | metric or imperial, the setting you chose on the website. |
default_project_id | The project that receives runs when you don't name one. |
Check your plan before a flight simulation
Flight simulations need the Pro plan. The list entitlements["sim_types"] names the kinds of run your plan allows, bench for a test bench run and flight for a flight. A flight is flight:
if "flight" not in me["entitlements"]["sim_types"]:
print("Your plan does not include flight simulations.")If you submit one anyway, the call fails with an APIError whose http_status is 402. See Error handling. Plans and prices are on the pricing page.
What the key can see
The key acts as you. It sees your projects, your own parts and your runs, and nobody else's. Create and revoke keys on the API keys tab of your Account page. You can't do that from the library.