Unity-Py is a Python client to simplify interactions with NASA's Unity Platform.
Project description
Unity-Py
Unity-Py is a Python client to simplify interactions with NASA's Unity Platform.
Installation
Install from pypi
pip install unity-sds-client
Install from Github
python -m pip install git+https://github.com/unity-sds/unity-py.git
Building and installing locally using poetry
git clone https://github.com/unity-sds/unity-py.git
cd unity-py
poetry install
Getting Started
Authorization
Authorization can be handled interactively, in which case you will be prompted for a username/password when calling the Unity() method, or can be handled by way of environment variables:
export UNITY_USER=MY_UNITY_USERNAME
export UNITY_PASSWORD=MY_UNITY_PASSWORD
The order of Authentication Parameters is as follows:
- Environment variables
- Prompt for username and password
Running your first command
from unity_sds_client.unity import Unity
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.unity_services import UnityServices as services
s = Unity()
dataManager = s.client(services.DATA_SERVICE)
collections = dataManager.get_collections()
print(collections)
cd = dataManager.get_collection_data(collections[0])
for dataset in cd:
print(f'dataset name: {dataset.id}' )
for f in dataset.datafiles:
print("\t" + f.location)
Testing
To run unit and regression tests:
# run all tests and include printouts:
poetry run pytest -s
# run non-regression tests:
poetry run pytest -m "not regression"
# run regression tests (and include logs)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
unity-sds-client-0.2.0.tar.gz
(21.0 kB
view hashes)
Built Distribution
Close
Hashes for unity_sds_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9c7899b50f786b01434526401a01b732881d85db55ea59f271f372f7895cd88 |
|
MD5 | 9754bb103ec1195f3e9c2d19e3f72594 |
|
BLAKE2b-256 | c86a54e66bd6f741431f421a8089d35e06556973d633a8e6b6a27fd18f25776a |