Skip to main content

Functions to interact with the Seven2one TechStack

Project description

Usage

Connect

Interactive with client id from your OAuth 2 provider:

from seven2one import TechStack
client = TechStack(host, client_id)

In unattended scripts via service account:

from seven2one import TechStack
client = TechStack(host, client_id, service_account_name='my-serviceuser', service_account_secret='some token')

Logging

By default the Python lib writes logs to console and to the server the user connects to.

Configure log levels and server endpoint by environment variables if needed:

Variable Description Default
LOGLEVEL Set the log level for console output 'INFO'
LOGLEVEL_SERVER Set the log level for logs sent to the server (Loki). Log levels are 'ERROR', 'WARNING', 'INFO' and 'DEBUG'. 'ERROR'
LOG_TO_SERVER Disable logging to Loki server 'TRUE'
LOG_SERVER Overwrite the log server endpoint if e.g. running inside the same cluster 'https://{host}/logging/loki/api/v1/push'

Basic read operations

client.inventories()
client.items('appartments', references=True)
client.inventoryProperties('appartments')
client.propertyList('appartments', references=True, dataTypes=True)

Write operations

Create inventory

properties = [
   {
        'dataType': 'DATE_TIME_OFFSET',
        'name': 'fieldDATETIMEOFFSET',
        'nullable': True
    },
    {
        'dataType': 'BOOLEAN',
        'name': 'fieldBOOLEAN',
        'nullable': True
    }
]

client.createInventory('testInventory', properties)

Add (basic) items

items =  [
        {
        "fieldSTRING": "bla",
        "fieldDECIMAL": 0,
        "fieldLONG": 0,
        "fieldINT": 0,
        "fieldBOOLEAN": True,
        "fieldDATETIME":  "2021-09-14T00:00:00.000Z",
        "fieldDATETIMEOFFSET": "2021-09-14T00:00:00.000Z"
    }
]

addBasicItems('testInventory', items)

Advanced

To change one or more used service endpoints (e.g. for tests against custom deployments) you can overwrite them by environment variables. You have to provide complete URL's.

Environment variable Description Example
IDENDITYPROVIDER_URL Identity provider base url https://authentik.mytechstack
DYNAMIC_OBJECTS_ENDPOINT DynO graphQL endpoint https://run.integrationtest.s2o.dev/itest-375545a3-dynamic-objects/graphql/
AUTOMATION_ENDPOINT Automation service graphQL endpoint
SCHEDULE_ENDPOINT Schedule service graphQL endpoint
PROGRAMMING_ENDPOINT Programming service graphQL endpoint
TIMESERIES_ENDPOINT TimeSeries gateway graphQL endpoint
LOGGING_ENDPOINT Logging reverse proxy endpoint http://mytechstack:8123/loki/api/v1/push
AUTHORIZATION_ENDPOINT Authorization service graphQL endpoint

Project details


Release history Release notifications | RSS feed

This version

6.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seven2one-6.0.0.tar.gz (66.2 kB view details)

Uploaded Source

Built Distribution

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

seven2one-6.0.0-py3-none-any.whl (73.7 kB view details)

Uploaded Python 3

File details

Details for the file seven2one-6.0.0.tar.gz.

File metadata

  • Download URL: seven2one-6.0.0.tar.gz
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for seven2one-6.0.0.tar.gz
Algorithm Hash digest
SHA256 1009a3ffe71d93e4570b652464a4ab02db624f2c7cbe48cd6c70150bdd6e4816
MD5 355c8e5965cdf4d11d0f4e1b797c1506
BLAKE2b-256 5110a3fd553bcdca96d80260fbd66ca7777106d56929f820a7b6dda8253de4bb

See more details on using hashes here.

File details

Details for the file seven2one-6.0.0-py3-none-any.whl.

File metadata

  • Download URL: seven2one-6.0.0-py3-none-any.whl
  • Upload date:
  • Size: 73.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for seven2one-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c4c19823083f8446b0aead88670c82a6e508db8cd1b3cd063122f743e7f6fff
MD5 56d1e91346302d71d13bf5c5b1071a01
BLAKE2b-256 6de0169831e0f8d46e6be56745d26eda315a1e06d6310516d3f2a128b9d1b774

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