@@ -37,25 +37,6 @@ def __init__(self, code = '', message = '', href = ''):
3737 def __str__ (self ):
3838 return '{"code": %s, "message": %s, "href": %s}' % (self .code , self .message , self .href )
3939
40- class KepServiceStatus :
41- '''A class to represent a status object when checking on a "service" API job state in Kepware. This is
42- used to return the status of a "service" job
43-
44- Properties:
45-
46- "complete" - Boolean of service job completion status
47- "status" - Status code of job
48- "message" - Error message if service job fails
49-
50- '''
51- def __init__ (self , complete = '' , status = '' , message = '' ):
52- self .status = status
53- self .message = message
54- self .complete = complete
55-
56- def __str__ (self ):
57- return '{"complete": %s, "status": %s, "message": %s}' % (self .complete , self .status , self .message )
58-
5940class _HttpDataAbstract :
6041 def __init__ (self ):
6142 self .payload = ''
@@ -81,12 +62,9 @@ class server:
8162
8263 Methods:
8364
84- "reinitialize()" - reinitialize the Kepware server
65+ "reinitialize()" - Reinitialize the Kepware server
8566 "get_trans_log()" - retrieve the Configuration API transaction logs
8667 "get_event_log()" - retrieve the Kepware Event Log
87- "get_project_properties()" - retrieve the Kepware Project Properties
88- "modify_project_properties()" - modify the Kepware Project Properties
89- "service_status()" - retrive service job status
9068 '''
9169 __root_url = '/config'
9270 __version_url = '/v1'
@@ -235,30 +213,6 @@ def modify_project_properties(self, DATA, force = False) -> bool:
235213 r = self ._config_update (self .url + '/project' , prop_data )
236214 if r .code == 200 : return True
237215 else : raise KepHTTPError (r .url , r .code , r .msg , r .hdrs , r .payload )
238-
239- def service_status (self , resp : KepServiceResponse ):
240- '''Returns the status of a service job. Used to verify if a service call
241- has completed or not.
242-
243- INPUT:
244- "resp" - KepServiceResponse instance with job information
245-
246- RETURNS:
247- KepServiceStatus instance with job status
248-
249- EXCEPTIONS:
250-
251- KepHTTPError - If urllib provides an HTTPError
252- KepURLError - If urllib provides an URLError
253- '''
254- # need to remove part of job href
255- loc = resp .href .find (self .__root_url + self .__version_url )
256- job_url = resp .href [loc + len (self .__root_url + self .__version_url ):]
257-
258- r = self ._config_get (self .url + job_url )
259- job = KepServiceStatus (r .payload ['servermain.JOB_COMPLETE' ],r .payload ['servermain.JOB_STATUS' ], r .payload ['servermain.JOB_STATUS_MSG' ])
260- return job
261-
262216
263217 #Function used to Add an object to Kepware (HTTP POST)
264218 def _config_add (self , url , DATA ):
@@ -325,7 +279,7 @@ def _force_update_check(self, force, DATA):
325279 pass
326280 return DATA
327281 # General service call handler
328- def _kep_service_execute (self , url , TTL = None ):
282+ def _kep_service_execute (self , url , TTL ):
329283 try :
330284 if TTL != None :
331285 TTL = {"servermain.JOB_TIME_TO_LIVE_SECONDS" : TTL }
0 commit comments