Skip to content

sos-berlin/js7-client-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS7 Python Client

PyPI version Python versions

The JS7 Python Client provides methods for accessing the JS7 JOC REST API. It offers functionality similar to the JS7 Unix CLI: JS7 Unix CLI.

Requirements

  • Python version 3.8 or later
  • A JS7 installation with version 2.6.5–2.8.3
  • A Java JVM version 17 or later for encryption and decryption functionality

Installation

pip install js7-client-python

Quick Start

The following example shows how to create a client instance and perform an operation.

Note: Additional examples showing how the client can be used can be found in the ./example directory of this repository.

Client Initialization

Client initialization begins with configuring the JOC API endpoint and the user’s credentials.

import js7

client = js7.Client(
    http_config=js7.model.HTTPConfiguration(
        host="192.168.1.14",
        port=4443
    ),
    auth_config=js7.model.AuthConfiguration(
        basic_auth=js7.model.BasicAuth(
            username="root",
            password="changeit"
        )
    )
)

SSL and Certificate-Based Authentication

The code snippet above shows authentication using Basic Auth. However, the JS7 Python Client also supports certificate-based authentication and client certificates for HTTPS connections.

client = js7.Client(
    http_config=js7.model.HTTPConfiguration(
        host="192.168.1.14",
        port=4446,
        ssl=True,
        cafile_path="./certificate.crt"
    ),
    auth_config=js7.model.AuthConfiguration(
        cert_auth=js7.model.CertAuth(
            certfile_path="./client.crt",
            keyfile_path="./client.key"
        )
    )
)

Import Inventory Configurations

A common use case is importing inventory configurations into JS7 JOC. We use the previously created client instance to import configurations.

ok = client.inventory.manage.import_configurations(
    file_path="/path/to/file/or/folder",
    inventory_target_folder="/test-folder"
)

print(f"Operation successful: {ok}")

Namespaces

The Client class follows the domains of the JS7 JOC API, but groups its methods into three namespaces:

  • Manage: Used to manage configurations and resources, such as importing, updating, or removing them.
  • Operate: Used to control runtime behavior, such as resuming a workflow or canceling an order.
  • Deploy: Used to deploy configurations, such as workflows.

Resources

About

Python Client for access to JS7 REST API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages