Skip to main content

Itential Python SDK

Project description

ipsdk

The Itential Python SDK provides a client implementation in Python for writing scripts that can make API calls to Itential Platform or Itential Automation Gateway 4.x.

Features

  • Easy API requests with automatic authentication
  • Support for OAuth and user/password login
  • Customizable connection settings
  • Centralized logging configuration

Getting started

Requirements

  • Python 3.8 or higher
  • httpx >= 0.28.1

Tested Python Versions

Python Version Status Notes
3.10 ✅ Tested Minimum recommended version
3.11 ✅ Tested Full support
3.12 ✅ Tested Full support
3.13 ✅ Tested Latest stable release
3.14 🔄 Beta Development/preview testing

The SDK is automatically tested against Python 3.10-3.13 in our CI pipeline to ensure compatibility across all supported versions.

Installation

Install ipsdk using pip:

$ pip install ipsdk

Or using uv (recommended for development):

$ uv add ipsdk

The ipsdk package provides factory functions for connecting to either Itential Platform or Itential Automation Gateway.

The platform_factory(...) function creates a connection to Itential Platform The gateway_factory(...) function creates a connection to Itential Automation Gateway

Use one of the factory functions to create a new connection to the server and send requests.

>>> import ipsdk
>>> platform = ipsdk.platform_factory(host="platform.itential.dev", user="admin@pronghorn")
>>> res = platform.get("/health/server")
>>> res
<Response [200 OK]>
>>> res.text
'{"version":"15.8.10-2023.2.44","release":"2023.2.9"...`

The above works the same for Itential Automation Gateway, simply use gateway_factory instead of platform_factory to connect to Itential Automation Gateway.

Itential Python SDK also supports using asyncio to connect to servers as well. The example below demonstrates how to connect to the server using an async connection.

import asyncio
import ipsdk

async def main():
    p = ipsdk.platform_factory(
        host="platform.itential.dev",
        user="admin@pronghorn",
        want_async=True
    )

    res = await p.get("/adapters")

if __name__ == "__main__":
    asyncio.run(main())

The connection object supports the following HTTP methods:

  • GET - Sends a HTTP GET request to the server and returns the results
  • POST - Sends a HTTP POST request to the server and returns the results
  • PUT - Sends a HTTP PUT request to the server and returns the results
  • DELETE - Sends a HTTP DELETE request to the server and returns the results
  • PATCH - Sends a HTTP PATCH request to the server and returns the results

The following table shows the keyword arguments for each HTTP method:

Keyword GET POST PUT DELETE PATCH
path Required Required Required Required Required
params Optional Optional Optional Optional Optional
json Not Supported Optional Optional Not Supported Optional

The path argument specifies the relative path of the URI. This value is prepended to the base URL. The base URL for Itential Platform is <host> and the base URL for Itential Automation Gateway is <host>/api/v2.0.

The params argument accepts a dict object that is transformed into the URL query string. For example, if params={"foo": "bar"} the resulting query string would be ?foo=bar

The json argument accepts the payload to send in the request as JSON. This argument accepts either a list or dict object. When specified, the data will automatically be converted to a JSON string and the Content-Type and Accept headers will be set to application/json.

Configuration

Both the platform_factory and gateway_factory functions support configuration using keyword arguments. The table below shows the keyword arguments for each function along with their default value.

Keyword platform_factory gateway_factory
host localhost localhost
port 0 0
use_tls True True
verify True True
user admin admin@itential
password admin admin
client_id None Not Supported
client_secret None Not Supported
timeout 30 30
want_async False False

Development

For development setup, testing, and contribution guidelines, see the Development Guide.

License

This project is licensed under the GPLv3 open source license. See license

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

ipsdk-0.4.0.tar.gz (99.5 kB view details)

Uploaded Source

Built Distribution

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

ipsdk-0.4.0-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file ipsdk-0.4.0.tar.gz.

File metadata

  • Download URL: ipsdk-0.4.0.tar.gz
  • Upload date:
  • Size: 99.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for ipsdk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d8c3334329d3ea875d929e6bda1a7e90a37ddf15b0c307e5a3bb77e872b82cfc
MD5 36d72291f8c1a47cd5701f95bb9c72d6
BLAKE2b-256 1032a045988712bdfb79718f845428296673ece36c48f9c80f36d3f691a9e888

See more details on using hashes here.

File details

Details for the file ipsdk-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ipsdk-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for ipsdk-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfe9a521908acde7aaa557887e66c4ca3fe5a77dd851acc6002c6dc78ba8fd3f
MD5 5e6b67502bc0e5f80b1aeb9043c9e146
BLAKE2b-256 7c5042f8e4f2369e62837c32d6ddd568e233162e89f69a8654cecd9d896ce117

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