Package: kepconfig
Kepware Configuration API SDK for PythonThis 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).API reference documentation is available onGithub PagesPrerequisitesPackage 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 theurllibPython standard library.FeaturesSupports both HTTP and HTTPS connections with certificate validation optionsSDK allows forGET,ADD,DELETE, andMODIFYfunctions for the following Kepware configuration objects:FeaturesTKS/KEPTKEProject Properties(Get and Modify Only)YYConnectivity(Channel, Devices, Tags, Tag Groups)YYIoT Gateway(Agents, IoT Items)YYDatalogger(Log Groups, Items, Mapping, Triggers, Reset Mapping Service)YYAdministration(User Groups, Users, UA Endpoints, Local License Server)Y*YProduct Info and Health Status**YYNote (*) - UA Endpoints and Local License Server supported for Kepware Edge onlyNote (**) - Added to Kepware Server v6.13 / Kepware Edge v1.5 and later buildsDriver specific features:DriverFeaturesGE Ethernet Global DataExchanges, Ranges and Name ResolutionsUniversal Device DriverProfile LibraryMethods to read the following logs:LogsTKS/KEPTKEEvent LogYYAPI Transaction LogYYConfiguration APIServicesimplemented:ServicesTKS/KEPTKETagGeneration(for supported drivers)YYReinitializeRuntimeY*YProjectLoad and ProjectSaveYYNote (*) - Reinitialize service was implemented for Kepware Server v6.8+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 inconnection.pyKnown LimitationsOther property configuration for more complex drivers with objects besides channels, devices, tags and tag groups are not always explicitly definedOther supported plug-ins (EFM Exporter, Scheduler, etc) are not definedWhen 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.InstallationPackage can be installed withpipusing the following:pip install kepconfigKey ConceptsNOTE: Detailed examples can also be found in theexamplesfolder.Create server connectionfromkepconfigimportconnectionserver=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 CA certificate store. The connection uses the "create_default_context()" function as part of urllib as described at the following links:ssl.create_default_contextssl.SSLContext.load_default_certsset_default_verify_pathsFor Windows OSes, the Kepware server's instance certificate can be loaded into the hosts "Trusted Root Certificate Authorities" store.Create an objectObjects such as channels or devices can be created either singularly or with children included.Ex: Add Single channelfromkepconfig.connectivityimportchannelchannel_data={"common.ALLTYPES_NAME":"Channel1","servermain.MULTIPLE_TYPES_DEVICE_DRIVER":"Simulator"}result=channel.add_channel(server,channel_data)Ex: Add Multiple tagsfromkepconfig.connectivityimporttagtag_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 InformationVisit:Kepware.comPTC.com