Skip to main content

Python SDK for interacting with NVIDIA Air

Project description

air_sdk

This project provides a Python SDK for interacting with the NVIDIA Air API (https://air.nvidia.com/api/).

Click here for the full documentation

Prerequisite

The SDK requires python 3.7 or later. The safest way to install the SDK is to set up a virtual environment in python3.7:

apt-get install python3.7
python3.7 -m pip install virtualenv
python3.7 -m virtualenv venv37
. venv37/bin/activate

Installation

To install the SDK, use pip:

python3 -m pip install air-sdk

Usage

>>> from air_sdk import AirApi
>>> air = AirApi(username='<user>', password='<password>')

Authentication Options

Using the API requires the use of either an API token, a username/password, or a bearer token.

API token

To use an API token, one must first be generated. The easiest way to do this is via the Air UI.

Once a token is generated:

>>> air = AirApi(username='<username>', password='<api_token>')

Username/Password

To use a username/password, an administrator of NVIDIA Air must provision a service account. Once the administrator provides the username and password:

>>> air = AirApi(username='<username>', password='<password>')

Bearer token

Generally, it's recommended to use an API Token over a bearer token. However, a bearer token might be used for testing or quick-and-dirty operations that might not need a long term API token. To use a bearer token, the calling user must have a nvidia.com account and have previously approved access for NVIDIA Air. Once a token is obtained:

>>> air = AirApi(bearer_token='<bearer_token>')

Interacting with the API

The SDK provides various helper methods for interacting with the API. For example:

>>> air.simulations.list()
[<Simulation sim1 c51b49b6-94a7-4c93-950c-e7fa4883591>, <Simulation sim2 3134711d-015e-49fb-a6ca-68248a8d4aff>]
>>> sim1 = air.simulations.get('c51b49b6-94a7-4c93-950c-e7fa4883591')
>>> sim1.title = 'My Sim'
>>> sim1.store()

Developing

Contributions to the SDK are very welcome. All code must pass linting and unit testing before it will be merged.

Requirements

python3 -m pip install -r requirements-dev.txt

Linting

pylint **/*.py

Unit testing

./unit_test.sh

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

air-sdk-2.3.0.tar.gz (43.7 kB view hashes)

Uploaded Source

Built Distribution

air_sdk-2.3.0-py3-none-any.whl (81.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page