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

AuthenticationError

401

No key, or a key that is wrong or revoked

PermissionDenied

403

Your organisation may not do this

FeatureNotIncluded

403

A feature your tier does not include

NotFound

404

No such resource in your organisation

InvalidRequest

422

The request cannot be accepted; the message says why

ServerError

5xx

The fault is ours

ConfigurationError

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.