Major Tom Script API Package
Python Package for interacting with Major Tom's Scripting API.
The Package contains both a high-level and low-level API.
High-Level API
This API is in alpha. Please use with caution.
The new high-level API aims to make the user experience easier by providing canned methods and models for common operations. We trade both customizability and efficiency for ease-of-use. For example, to schedule a command on an upcoming pass, it is only a few lines of code:
# Customize these to your mission
token = "your script token"
host = "your_instance.majortom.cloud"
satellite_name = "your already-created satellite"
command_name = "your already-created command"
#-------------------------------------------------
api = ModelingAPI(host=host, token=token) # Create the API
AQUA = api.satellite(name=satellite_name) # Get the satellite
aPass = AQUA.next_pass() # Get the next pass
definition = AQUA.get_command_definition(command_name) # Get a specific command
aPass.schedule_command(definition) # Schedule it on a pass
More examples are available on in our demo repo.
Low-Level API
The low-level API provides direct access to the GraphQL query and mutation methods. Users will have to construct a GraphQL query and provide the correct variables in order to use the API. Although it requires more upfront work, the low-level API is the most efficient and customizable way to interact with Major Tom.
Here is an example of retrieving all TLEs from all satellites whose name includes the string "v2" from within a particular mission.
# Customize these to your mission
token = "your script token"
host = "your_instance.majortom.cloud"
mission_id = 1
#-------------------------------------------------
api = ScriptingAPI(host=host, token=token)
graphql = """
query GetSystems (
$missionId: ID!,
$systemFilters: SystemFilter,
) {
mission(id: $missionId) {
id
systems(filters: $systemFilters, orderBy: { sort: NAME, direction: ASC }) {
edges {
node {
id
tle
}
}
}
}
}
"""
response = api.query(graphql,
variables={
'missionId': mission_id,
'systemFilters': {
"type": "Satellite",
"nameSubstring": "v2"}
},
path='data.mission.systems.edges')
print(response)
The GraphQL schema and documentation can be found inside Major Tom on the same page where a Script Token is available. Look for the button labelled "GraphQL Playground".
Examples
Example scripts can be found in our demo repo.
Development
The Scripting API Package is currently in Beta, so please give us feedback or come talk to us!
Testing
To run all tests, execute ./bin/docker_testw.sh.
Metadata
Release files for majortom-scripting 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| majortom_scripting-1.0.1.tar.gz | 15.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| majortom_scripting-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / majortom_scripting-1.0.1.tar.gz
| Download URL | majortom_scripting-1.0.1.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
001f5dc726ed0202894e94ba73dfb8d739c903a53574e993f5b2a7808e4bcf1b
|
|
BLAKE2b-256 checksum How to use checksums |
6160ce264f85ea7a3bb53b69406ca6340571a6fabaf2b2b47734f93c580183ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Release files / majortom_scripting-1.0.1-py3-none-any.whl
| Download URL | majortom_scripting-1.0.1-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ebce41d4842ddde34f981fa64956b57b3f1f284cdc903b0b8500c58bb7702a6
|
|
BLAKE2b-256 checksum How to use checksums |
4ec4ddd472e4f16edd588e7a716641d50a6506d4f07ad87673f694f229a39f10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Security for majortom-scripting 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.