Kepware Configuration API SDK for Python
This is a package to help create Python applications to conduct operations with the Kepware Configuration API. This package is designed to work with all versions of Kepware that support the Configuration API including Thingworx Kepware Server (TKS), Thingworx Kepware Edge (TKE) and KEPServerEX (KEP). For reference, Kepware Server in this documentation will refer to both TKS and KEP versions.
API reference documentation is available on Github Pages
Prerequisites
Package supported and tested on Python 3.9 or later. Older versions support earlier Python 3 environments but have less functionality. All HTTP communication is handled by the urllib Python standard library.
Features
- Supports both HTTP and HTTPS connections with certificate validation options
Package allows for GET, ADD, DELETE, and MODIFY functions for the following Kepware configuration objects:
| Features | TKS/KEP | TKE |
|---|---|---|
| Project Properties (Get and Modify Only) |
Y | Y |
| Connectivity (Channel, Devices, Tags, Tag Groups) |
Y | Y |
| IoT Gateway (Agents, IoT Items) |
Y | Y |
| Datalogger (Log Groups, Items, Mapping, Triggers, Reset Mapping Service) |
Y | N |
| UA Gateway (Certificates, Server Endpoints, Client Connections, Server Interface parameters) |
Y*** | N |
| Advanced Tags (All tag types and tag groups) |
Y****** | N |
| Administration (User Groups, Users, UA Endpoints, Local License Server) |
Y* | Y |
| Product Info and Health Status** | Y | Y |
| Import Project (via JsonProjectLoad Service) / Export Project**** | Y | Y |
| Backup Project (via CreateBackup Service) / Export Project***** | Y | Y |
- Note (*) - UA Endpoints and Local License Server supported for TKE only
- Note (**) - Added to Kepware Server v6.13 / TKE v1.5 and later builds
- Note (***) - TKS only v6.16 and later
- Note (****) - Added to Kepware Server v6.17 / TKE v1.10 and later builds
- Note (*****) - Added to Kepware Server v6.18 / TKE v1.11 and later builds
Driver specific features:
| Driver | Features |
|---|---|
| GE Ethernet Global Data | Exchanges, Ranges and Name Resolutions |
| Universal Device Driver | Profile Library |
Methods to read the following logs:
| Logs | TKS/KEP | TKE |
|---|---|---|
| Event Log | Y | Y |
| API Transaction Log | Y | Y |
| Audit Log* | Y | Y |
- Note (*) - Implemented for Kepware Server v6.18+ and TKE 1.11+
Configuration API Services implemented:
| Services | TKS/KEP | TKE |
|---|---|---|
| TagGeneration (for supported drivers) |
Y | Y |
| ReinitializeRuntime | Y* | Y |
| ProjectLoad and ProjectSave | Y | Y |
| JsonProjectLoad** (used for import project feature) |
Y | Y |
| CreateBackup*** | Y | Y |
- Note (*) - Reinitialize service was implemented for Kepware Server v6.8+
- Note (**) - Added to Kepware Server v6.17 / TKE v1.10 and later builds
- Note (***) - Added to Kepware Server v6.18 / TKE v1.11 and later builds
Filtering, sorting and pagination query options are added for any collections methods (ex: get_all_devices() or get_all_channel()).
Generic REST methods are provided to use for functions not developed in SDK package. These are found in the Server class in connection.py
Known Limitations
- Other property configuration for more complex drivers with objects besides channels, devices, tags and tag groups are not always explicitly defined
- Other supported plug-ins (EFM Exporter, Scheduler, etc) are not defined
- When using hostnames (not IP addresses) for connections, delays may occur under certain network configurations as the connection may attempt IPv6 connections first. IPv6 is not supported by Kepware servers at this time.
Installation
Package can be installed with pip using the following:
pip install kepconfig
Key Concepts
NOTE: Detailed examples can also be found in the examples folder.
Create server connection instance
from kepconfig import connection
server = connection.server(host = '127.0.0.1', port = 57412, user = 'Administrator', pw = '')
# For HTTPS connections:
server = connection.server(host = '127.0.0.1', port = 57512, user = 'Administrator', pw = '', https=True)
For certificate validation, the SDK uses the OS/systems trusted certificate store. The connection uses the create_default_context() function as part of urllib as described at the following links:
For Windows OSes, the Kepware Server's instance certificate can be loaded into the hosts "Trusted Root Certificate Authorities" store.
Create an object
Objects such as channels or devices can be created either singularly or with children included.
Ex: Add Single channel
from kepconfig.connectivity import channel
channel_data = {"common.ALLTYPES_NAME": "Channel1","servermain.MULTIPLE_TYPES_DEVICE_DRIVER": "Simulator"}
result = channel.add_channel(server,channel_data)
Ex: Add Multiple tags
from kepconfig.connectivity import tag
tag_info = [
{
"common.ALLTYPES_NAME": "Temp",
"servermain.TAG_ADDRESS": "R0"
},
{
"common.ALLTYPES_NAME": "Temp2",
"servermain.TAG_ADDRESS": "R1"
}
]
tag_path = '{}.{}.{}'.format(ch_name, dev_name, tag_group_path)
result = tag.add_tag(server, tag_path, tag_info)
Need More Information
Visit:
Metadata
Release files for kepconfig 1.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kepconfig-1.4.2.tar.gz | 38.6 kB | Without provenance | Details for kepconfig-1.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kepconfig-1.4.2-py3-none-any.whl | Python 3 | none | any | Details for kepconfig-1.4.2-py3-none-any.whl |
Total release size: 115.0 kB
Release files / kepconfig-1.4.2.tar.gz
| Download URL | kepconfig-1.4.2.tar.gz |
|---|---|
| Size | 38.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21d53105b0f9c56fbb99e28fbab4059429b55becae48e74b121eaac8839e9a96
|
|
BLAKE2b-256 checksum How to use checksums |
958263d7b6ce088f0b1fe28ca367f17672b986db49c9c2da560793a923060806
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Release files / kepconfig-1.4.2-py3-none-any.whl
| Download URL | kepconfig-1.4.2-py3-none-any.whl |
|---|---|
| Size | 76.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ef840e71e3b293fe989f9aa772007bb63be6e210321906c89c00cc0f944fa6a
|
|
BLAKE2b-256 checksum How to use checksums |
18c58df72c00ce643ddf18ecd2461c1c7039564e2bedec34f0c6ef86e3ebf202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Security for kepconfig 1.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.