Skip to content

Commit c9e52e0

Browse files
authored
Merge pull request #24 from PTCInc/1.2.0-dev
Kepconfig 1.2.0 release
2 parents 848d0c5 + 251c4db commit c9e52e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1885
-1842
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Kepware Configuration API SDK for Python
22

3-
[![PyPI version](https://badge.fury.io/py/kepconfig.svg)](https://badge.fury.io/py/kepconfig)
3+
[![Released Version](https://img.shields.io/pypi/v/kepconfig)](https://pypi.org/project/kepconfig) [![Supported Versions](https://img.shields.io/pypi/pyversions/kepconfig)](https://pypi.org/project/kepconfig) ![PyPI - Downloads](https://img.shields.io/pypi/dm/kepconfig) ![PyPI - License](https://img.shields.io/pypi/l/kepconfig)
44

5-
This is a package SDK to create Python modules 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).
5+
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).
66

77
## Prerequisites
88

9-
The client libraries are supported on Python 3.6 or later. All HTTP communication is handled by the [urllib](https://docs.python.org/3.6/library/urllib.html#module-urllib) Python standard library.
9+
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](https://docs.python.org/3/library/urllib.html#module-urllib) Python standard library.
1010

1111
## Features
1212

@@ -21,14 +21,17 @@ SDK allows for *GET*, *ADD*, *DELETE*, and *MODIFY* functions for the following
2121
| **IoT Gateway** <br /> *(Agents, IoT Items)* | Y | Y |
2222
| **Datalogger** <br /> *(Log Groups, Items, Mapping, Triggers, Reset Mapping Service)* | Y | Y |
2323
| **Administration** <br /> *(User Groups, Users, UA Endpoints, Local License Server)* | Y* | Y |
24+
| **Product Info and Health Status\*\*** | Y | Y |
2425

25-
Note (*) - UA Endpoints and Local License Server supported for Kepware Edge only
26+
- Note (*) - UA Endpoints and Local License Server supported for Kepware Edge only
27+
- Note (**) - Added to Kepware Server v6.13 / Kepware Edge v1.5 and later builds
2628

2729
Driver specific features:
2830

2931
| Driver | Features |
3032
| :----------: | :----------: |
3133
|GE Ethernet Global Data|Exchanges, Ranges and Name Resolutions|
34+
|Universal Device Driver|Profile Library|
3235

3336
Methods to read the following logs:
3437

@@ -41,16 +44,19 @@ Configuration API *Services* implemented:
4144

4245
| Services | TKS/KEP | TKE |
4346
| :----------: | :----------: | :----------: |
44-
| **TagGeneration** <br /> *(for supported drivers)* | Y | Y |
47+
| **TagGeneration**<br />*(for supported drivers)* | Y | Y |
4548
| **ReinitializeRuntime** | Y* | Y |
49+
| **ProjectLoad and ProjectSave**| Y | Y |
4650

4751
Note (*) - Reinitialize service was implemented for Kepware Server v6.8+
4852

49-
Generic REST methods are provided to use for functions not developed in SDK package. These are found in the Server Class in [connection.py](/kepconfig/connection.py)
53+
Filtering, sorting and pagination query options are added for any collections methods (ex: get_all_devices() or get_all_channel()).
54+
55+
Generic REST methods are provided to use for functions not developed in SDK package. These are found in the Server Class in [connection.py](./kepconfig/connection.py)
5056

5157
## Known Limitations
5258

53-
- Other property configuration for more complex drivers with objects besides channels, devices, tags and tag groups are not explicitly defined
59+
- Other property configuration for more complex drivers with objects besides channels, devices, tags and tag groups are not always explicitly defined
5460
- Other supported plug-ins (EFM Exporter, Scheduler, etc) are not defined
5561
- 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.
5662

@@ -64,7 +70,7 @@ Package can be installed with `pip` using the following:
6470

6571
## Key Concepts
6672

67-
NOTE: Samples can also be found in the [samples](samples) folder.
73+
NOTE: Detailed examples can also be found in the [examples](./examples/) folder.
6874

6975
### Create server connection
7076

@@ -74,7 +80,7 @@ import kepconfig.connection
7480
server = connection.server(host = '127.0.0.1', port = 57412, user = 'Administrator', pw = '')
7581

7682
# For HTTPS connections:
77-
server = connection.server(host = '127.0.0.1', port = 57412, user = 'Administrator', pw = '', https=True)
83+
server = connection.server(host = '127.0.0.1', port = 57512, user = 'Administrator', pw = '', https=True)
7884

7985
```
8086

@@ -124,5 +130,4 @@ result = tag.add_tag(server, tag_path, tag_info))
124130
**Visit:**
125131

126132
- [Kepware.com](https://www.kepware.com/)
127-
- [Configuration API Info](https://www.kepware.com/en-us/products/kepserverex/features/configuration-api/)
128133
- [PTC.com](https://www.ptc.com/)

samples/GE EGD exchanges example.py renamed to examples/GE EGD exchanges example.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
from kepconfig import connection, error
13-
from kepconfig.connectivity import channel, device, tag, egd
13+
from kepconfig.connectivity import channel, egd
1414

1515
# Channel and Device name to be used
1616
ch_name = 'EGD'
@@ -27,17 +27,17 @@
2727

2828
def ErrorHandler(err):
2929
# Generic Handler for exception errors
30-
if err.__class__ is error.KepError:
31-
print(err.msg)
32-
elif err.__class__ is error.KepHTTPError:
30+
if isinstance(err, error.KepHTTPError):
3331
print(err.code)
3432
print(err.msg)
3533
print(err.url)
3634
print(err.hdrs)
3735
print(err.payload)
38-
elif err.__class__ is error.KepURLError:
36+
elif isinstance(err, error.KepURLError):
3937
print(err.url)
4038
print(err.reason)
39+
elif isinstance(err, error.KepError):
40+
print(err.msg)
4141
else:
4242
print('Different Exception Received: {}'.format(err))
4343

@@ -94,7 +94,7 @@ def ErrorHandler(err):
9494
# Modify an Exchange
9595
try:
9696
print("{} - {}".format("Modify Consumer Exchange:", egd.exchange.modify_exchange(server, ch_name + '.' + dev_name, egd.CONSUMER_EXCHANGE,
97-
{"ge_ethernet_global_data.CONSUMER_EXCHANGE_NUMBER": 2}, consumer_exchange['common.ALLTYPES_NAME'])))
97+
{"ge_ethernet_global_data.CONSUMER_EXCHANGE_NUMBER": 2},exchange_name= consumer_exchange['common.ALLTYPES_NAME'])))
9898
except Exception as err:
9999
ErrorHandler(err)
100100

File renamed without changes.

samples/complex-example/Modbus2MQTT_MultiServer.py renamed to examples/complex-example/Modbus2MQTT_MultiServer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@
2424

2525
import csv
2626
import json
27-
import kepconfig
28-
from kepconfig.connectivity import channel, device, tag
27+
from kepconfig import error, connection
28+
from kepconfig.connectivity import channel, device
2929
import kepconfig.iot_gateway as IoT
3030

3131
def ErrorHandler(err):
3232
# Generic Handler for exception errors
33-
if err.__class__ is kepconfig.error.KepError:
34-
print(err.msg)
35-
elif err.__class__ is kepconfig.error.KepHTTPError:
33+
if isinstance(err, error.KepHTTPError):
3634
print(err.code)
3735
print(err.msg)
3836
print(err.url)
3937
print(err.hdrs)
4038
print(err.payload)
41-
elif err.__class__ is kepconfig.error.KepURLError:
39+
elif isinstance(err, error.KepURLError):
4240
print(err.url)
4341
print(err.reason)
42+
elif isinstance(err, error.KepError):
43+
print(err.msg)
4444
else:
4545
print('Different Exception Received: {}'.format(err))
4646

@@ -211,7 +211,7 @@ def make_tags(master_list, device, ttag, limit, titem):
211211

212212
print ("-- Channel and devices and agent creation attempt")
213213
for Kepware_IP in Kepware_IP_Array:
214-
server = kepconfig.connection.server(Kepware_IP, Kepware_Port, user, passw)
214+
server = connection.server(Kepware_IP, Kepware_Port, user, passw)
215215
try:
216216
print("{} - {}".format("Adding all devices", channel.add_channel(server,all_devices_JSON)))
217217
except Exception as err:

0 commit comments

Comments
 (0)