print(err.code) print(err.msg) print(err.url) print(err.hdrs) print(err.payload) elif err.__class__ is error.KepURLError: print(err.url) print(err.reason) else: print('Different Exception Received: {}'.format(err)) # This creates a server reference that is used to target all modifications of # the Kepware configuration server = connection.server(host='127.0.0.1', port=57412, user='******', pw='') # This Reinitializes Kepware's Server Runtime process, similar to manually reinitializing # using the Configuration UI or the Administrator tool. try: print('{} - {}'.format("Execute Reinitialize Service", server.reinitialize())) except Exception as err: ErrorHandler(err) # Add a Channel using the "ControlLogix Driver" with a ControlLogix 5500 family device. # This will be used to demonstrate the "Auto Tag Generation" service available. channel_data = { "common.ALLTYPES_NAME": ch_name,
print(err.msg) elif err.__class__ is error.KepHTTPError: print(err.code) print(err.msg) print(err.url) print(err.hdrs) print(err.payload) elif err.__class__ is error.KepURLError: print(err.url) print(err.reason) else: print('Different Exception Received: {}'.format(err)) # This creates a server reference that is used to target all modifications of # the Kepware configuration server = connection.server(host = 'localhost', port = 57513, user = '******', pw = '', https=True) # Disabling certificate validation (INSECURE) server.SSL_ignore_hostname = True server.SSL_trust_all_certs = True # Add the UA Endpoints to Kepware's UA server try: print("{} - {}".format("Adding multiple UA Endpoints",ua_server.add_endpoint(server,[uaendpoint1,uaendpoint2]))) except Exception as err: ErrorHandler(err) # Modify Endpoint to disable all encryption and allow unencrypted connections modify_ua = { "libadminsettings.UACONFIGMANAGER_ENDPOINT_SECURITY_NONE": True,
print(err.code) print(err.msg) print(err.url) print(err.hdrs) print(err.payload) elif err.__class__ is error.KepURLError: print(err.url) print(err.reason) else: print('Different Exception Received: {}'.format(err)) # This creates a server reference that is used to target all modifications of # the Kepware configuration server = connection.server(host='127.0.0.1', port=57412, user='******', pw='') # HTTP server reference examples. Uses the OS/systems trusted CA certificate store for cert validation as it uses the # "create_default_context()" function as described here: # https://docs.python.org/3/library/ssl.html#ssl.create_default_context # https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_default_certs # https://docs.python.org/3/library/ssl.html#ssl.SSLContext.set_default_verify_paths serverHTTPS = connection.server(host='127.0.0.1', port=57512, user='******', pw='', https=True) # Disable Hostname check when validating certificate: serverHTTPS.SSL_ignore_hostname = True
print(err.msg) print(err.url) print(err.hdrs) print(err.payload) elif err.__class__ is error.KepURLError: print(err.url) print(err.reason) else: print('Different Exception Received: {}'.format(err)) # This creates a server reference that is used to target all modifications of # the Kepware configuration server = connection.server(host='192.168.1.132', port=57513, user='******', pw='', https=True) # Disabling certificate validation (INSECURE) server.SSL_ignore_hostname = True server.SSL_trust_all_certs = True # Add the UA Endpoints to Kepware's UA server try: print("{} - {}".format( "Adding multiple UA Endpoints", ua_server.add_endpoint(server, [uaendpoint1, uaendpoint2]))) except Exception as err: HTTPErrorHandler(err)