Skip to content

About

The Armis SDK is a package that encapsulates common use-cases for interacting with the Armis platform.

Resources

Stars

5 stars

Watchers

3 watching

Forks

Repository files navigation

Armis SDK for Python 3.11+

Run tests Run formatter Run linter

The Armis SDK is a package that encapsulates common use cases for interacting with the Armis platform.

Installation

Use your favourite package manager to install the SDK, for example:

pip install armis_sdk

Documentation

For full documentation, please visit our documentation site.

Usage

All interaction with the SDK happens through the ArmisSdk class. You'll need five things:

  1. Audience: The URL of the tenant you want to interact with, including trailing slash (e.g. https://acme.armis.com/).
  2. Client ID: The email address of the user account within the tenant that was used to generate the Client Secret.
  3. Client Secret: The confidential credential generated by your customer within Armis, paired with the Client ID.
  4. Vendor ID: An identifier unique to your developer account or integration, obtained when you register on our developer portal.
  5. Scopes: The specific permissions required by your access token to interact with the desired API endpoints.

You can either provide these values using the environment variables ARMIS_AUDIENCE, ARMIS_CLIENT_ID, ARMIS_CLIENT_SECRET, ARMIS_VENDOR_ID, and ARMIS_SCOPES (comma-separated):

from armis_sdk import ArmisSdk

armis_sdk = ArmisSdk()

or by passing them explicitly:

from armis_sdk import ArmisSdk
from armis_sdk import ClientCredentials

credentials = ClientCredentials(
    audience="<audience>",
    client_id="<client_id>",
    client_secret="<client_secret>",
    vendor_id="<vendor_id>",
    scopes=["scope1", "scope2"],
)
armis_sdk = ArmisSdk(credentials=credentials)

Tip

If you're building an application that interacts with multiple tenants, you can populate only the ARMIS_VENDOR_ID and ARMIS_SCOPES environment variables and pass the audience, client_id and client_secret explicitly:

from armis_sdk import ArmisSdk
from armis_sdk import ClientCredentials

credentials = ClientCredentials(
    audience="<audience>",
    client_id="<client_id>",
    client_secret="<client_secret>",
)
armis_sdk = ArmisSdk(credentials=credentials)

Configuration

The following optional environment variables tune the SDK's HTTP behavior:

Variable Default Description
ARMIS_REQUEST_RETRIES 3 Number of times a failed request is retried (when applicable).
ARMIS_REQUEST_BACKOFF 0.5 Backoff factor, in seconds, between retries.
ARMIS_PAGE_SIZE 100 Number of items requested per page when listing.
HTTPS_PROXY / HTTP_PROXY unset Proxy to route requests through. HTTPS_PROXY takes precedence.

Entity clients

Once you have an instance of ArmisSdk, you can start interacting with the various clients. Each handles the use cases of a specific entity.

Note

All functions in this SDK that eventually make HTTP requests are asynchronous.

However, for convenience, all public asynchronous functions can also be executed in a synchronous way.

For example, if you want to update a site's location:

import asyncio

from armis_sdk import ArmisSdk
from armis_sdk.entities.site import Site

armis_sdk = ArmisSdk()


async def main():
    site = Site(id=1, location="new location")
    await armis_sdk.sites.update(site)


asyncio.run(main())

About

The Armis SDK is a package that encapsulates common use-cases for interacting with the Armis platform.

Resources

Stars

5 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages