Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

seven2one

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seven2one

Functions to interact with the Seven2one TechStack

  • 8.0.0
  • PyPI
  • Socket score

Maintainers
3

Usage

Local Installation

For local development, the package can be installed locally in editable mode:

pip install -e .

This will also install the required dependencies, taken from the setup.py, install_requires section (which will also be installed if this package is later installed via pip). If you want to just test the dependencies, you can install them using the requirements.txt file:

pip install -r requirements.txt

The requirements.txt and setup.py files should be kept in sync, so that the package can be installed in the same way in the production environment. Unfortunatelly, the setup.py file does not support the use of the requirements.txt file, so the dependencies have to be listed in both files.

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:

VariableDescriptionDefault
LOGLEVELSet the log level for console output'INFO'
LOGLEVEL_SERVERSet the log level for logs sent to the server (Loki). Log levels are 'ERROR', 'WARNING', 'INFO' and 'DEBUG'.'ERROR'
LOG_TO_SERVERDisable logging to Loki server'TRUE'
LOG_SERVEROverwrite 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 variableDescriptionExample
IDENDITYPROVIDER_URLIdentity provider base urlhttps://authentik.mytechstack
DYNAMIC_OBJECTS_ENDPOINTDynO graphQL endpointhttps://run.integrationtest.s2o.dev/itest-375545a3-dynamic-objects/graphql/
AUTOMATION_ENDPOINTAutomation service graphQL endpoint
SCHEDULE_ENDPOINTSchedule service graphQL endpoint
PROGRAMMING_ENDPOINTProgramming service graphQL endpoint
TIMESERIES_ENDPOINTTimeSeries gateway graphQL endpoint
LOGGING_ENDPOINTLogging reverse proxy endpointhttp://mytechstack:8123/loki/api/v1/push
AUTHORIZATION_ENDPOINTAuthorization service graphQL endpoint

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc