Errors, waiting and limits¶
Errors¶
Every error of the API is a LunaError carrying the HTTP status, the
API’s code where it gives one, and its message. The common ones have their own class:
Class |
Status |
When |
|---|---|---|
401 |
No key, or a key that is wrong or revoked |
|
403 |
Your organisation may not do this |
|
403 |
A feature your tier does not include |
|
404 |
No such resource in your organisation |
|
422 |
The request cannot be accepted; the message says why |
|
5xx |
The fault is ours |
|
No key was given, or the address is wrong |
from lunaspace import InvalidRequest, RunFailed
try:
run = client.runs.request(satellite, arc_start, arc_end).wait()
except InvalidRequest as error:
print("refused:", error)
except RunFailed as error:
print("failed:", error.code) # invalid_tracking_data, estimation_failed, ...
Waiting¶
Runs, comparisons, plans, passes, orbit events, TLEs and orbit files are made in the
background. Their wait() asks until the job has finished and returns it, raises
JobFailed (RunFailed for a run) with the
API’s error code when it failed, and WaitTimeout when it has not
finished in time. Give timeout= (seconds) and poll= to change how long and how often.
Limits¶
One uploaded file: 64 MB. All tracking data of an organisation: 5 GB.
Four runs queued or running at a time, 100 runs in 24 hours. Beyond that the API answers status 429; try again later. Scheduled runs and a comparison’s runs do not count.
These are the defaults. Your organisation’s tier may set others:
client.me().tier.