Skip to main content

Stax Python SDK

Project description

Stax SDK for Python

staxapp is the Stax Software Development Kit (SDK) for Python, allowing users to interact with the Stax platform.

codecov build deploy PyPI - Python Version

Authentication

In order to use the Stax SDK for Python, you will need a valid Stax API Token.

Installation

Install the package using pip:

pip install staxapp

Configure environment variables:

export STAX_REGION=au1.staxapp.cloud
export STAX_ACCESS_KEY=<your_access_key>
export STAX_SECRET_KEY=<your_secret_key>

Optional configuration:

Authentication token expiry

Allows configuration of the threshold to when the Auth library should re-cache the credentials Suggested use when running within CI/CD tools to reduce overall auth calls

export TOKEN_EXPIRY_THRESHOLD_IN_MINS=2 # Type: Integer representing minutes
Logging levels

As the logging levels are set on the import of the Config module, the below configuration is available on the presense of following environment variables:

  • LOG_LEVEL: Default logger level

Value of environment variables should match Python - Logging Levels

Example: Changing the logging from INFO to DEBUG

export LOG_LEVEL=DEBUG
python run_example.py

Usage

Read Accounts

The following code can be used to read accounts within your Stax Organisation:

import json
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# Read all accounts within your Stax Organisation
accounts = StaxClient("accounts")
response = accounts.ReadAccounts()
print(json.dumps(response, indent=4, sort_keys=True))

# Read all active accounts within your Stax Organisation and include tags in the response
accounts = StaxClient("accounts")
response = accounts.ReadAccounts(filter="ACTIVE", include_tags=True)
print(json.dumps(response, indent=4, sort_keys=True))

Contributing

For more information on contributing the to the Stax SDK, please see our guide.

Getting Help

  • If you're having trouble using the Stax SDK, please refer to our documentation.
  • If you've encountered an issue or found a bug, please open an issue.
  • For any other requests, please contact Stax support.

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

staxapp-1.2.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

staxapp-1.2.0-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file staxapp-1.2.0.tar.gz.

File metadata

  • Download URL: staxapp-1.2.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for staxapp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5374236fca559038e30b51370dd26595c371554d78e6629023962a43892efa30
MD5 7dde996047147d01ad86888f86f2ddd9
BLAKE2b-256 42afa691482a8b3fccc3711d8aa2f831be3f887728b14940e98e74a84995d20d

See more details on using hashes here.

File details

Details for the file staxapp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: staxapp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for staxapp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4af9e7251082b8fde39bb5fddfa0e936330b280caa9b1349741136a0815b811b
MD5 e1c7edc25dec4808b72fbadad00b19a4
BLAKE2b-256 93d465970fae5ca4d3faae5dfc58ca756181ba0aba863d432b3dbc05a042a432

See more details on using hashes here.

Supported by

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