Skip to main content

Forked Python SDK for the Omnia Timeseries API

Project description

Omnia Timeseries Python SDK

Python package for interacting with the Omnia Industrial IoT Timeseries API.

Forked version of Official python sdk available at https://github.com/equinor/omnia-timeseries-python.

How do I get set up?

To use the Python package, install it in the following manner:

pip install ots-sdk

For support, create an issue on GitHub.

Example usage

For fundamental questions please refer to the MSAL documentation which has code examples for multiple programming languages and scenarios.

You should also familiarize yourself with the azure.identity package, which we will use below.

Follow usage example to learn how to retrieve data in Json format.
Follow get data as protobuf example to learn how to retrieve data in Protobuf format.

Preparing Azure authentication

Please read https://github.com/equinor/OmniaPlant/wiki/Authentication-&-Authorization to familiarize yourself with how Timeseries API handles authentication and authorization.

We support the following authentication flows:

The supported credential setups are shown below.

With service principal credentials

Read Service-to-service using a shared secret and ensure prerequisite steps have been done.

from azure.identity import ClientSecretCredential
import os
credentials = ClientSecretCredential(
    tenant_id=os.environ['AZURE_TENANT_ID'],
    client_id=os.environ['AZURE_CLIENT_ID'],
    client_secret=os.environ['AZURE_CLIENT_SECRET']
)

With user impersonation

Read Authenticating by user impersonation without any shared secret (For people with Equinor accounts) and ensure prerequisite steps have been done.

For testing user impersonation you can use our public client ids:

  • 675bd975-260f-498e-82cd-65f67b34fe7d (test)
  • 67da184b-6bde-43fd-a155-30ed4ff162d2 (production)
from azure.identity import DeviceCodeCredential
import os
credentials = DeviceCodeCredential(
    tenant_id=os.environ['AZURE_TENANT_ID'],
    client_id=os.environ['AZURE_CLIENT_ID']
)

During authentication, this will display a URL to visit, and a code to enter. After completing the flow, execution will proceed.

With default credentials (azure cli, MSI and so on)

Read Managed Service Identity (For Equinor applications in Azure) and ensure prerequisite steps have been done.

from azure.identity import DefaultAzureCredential
credentials = DefaultAzureCredential()

Output

The Json response from Timeseries API looks like this:

>> {'items': [{'id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'datapoints': [{'time': '2021-02-01T09:54:05.4200000Z', 'value': -0.000286102294921875, 'status': 192}]}]}

The Protobuf response from Timeseries API looks like this:

{ "data": [ { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "totalCount": "1", "fields": [ "time", "value", "status" ], "values": [ { "int64": "1727263834898000000" }, { "double": 246.56092834472656 }, { "uint32": 192 } ] } ] }

Other use cases

Please consult the API Reference for a full overview of the API endpoints.

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

ots_sdk-1.0.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

ots_sdk-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file ots_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: ots_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.3 Darwin/25.0.0

File hashes

Hashes for ots_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5ff1535fcacc8601346fcf69ecd72905c26e62f9ebd56da03c7267fc92fc12e7
MD5 3419c0b64565bbc4f59d10a441401a51
BLAKE2b-256 31baaa68a66db919223733ffb9dd459b29f04f23e73a993c65394cd9afaa310d

See more details on using hashes here.

File details

Details for the file ots_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ots_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.3 Darwin/25.0.0

File hashes

Hashes for ots_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 097465b6c2aa850ddcc804829ee95010661ddc18fae8c3f633ca24fae61c32b3
MD5 859e09325983caf270f58d0b0f8b537c
BLAKE2b-256 593f41d06c5b06580dd69c6c6a50cd51879fd2fb35d8c7c805440eeb4ede73f6

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