mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-20 15:02:27 +02:00
2021-12-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Service()' type class to the 'rivwebpyapi' API. * Modified the 'rivwebpyapi.ListServices()' call to return a list of 'rivwebpyapi.Service' objects. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
0443fd9341
commit
6b923ffbda
@ -22775,3 +22775,7 @@
|
|||||||
a 'rivwebpyapi.Group' object.
|
a 'rivwebpyapi.Group' object.
|
||||||
* Modified the 'rivwebpyapi.ListGroups()' call to return
|
* Modified the 'rivwebpyapi.ListGroups()' call to return
|
||||||
a list of 'rivwebpyapi.Group' objects.
|
a list of 'rivwebpyapi.Group' objects.
|
||||||
|
2021-12-12 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'Service()' type class to the 'rivwebpyapi' API.
|
||||||
|
* Modified the 'rivwebpyapi.ListServices()' call to return
|
||||||
|
a list of 'rivwebpyapi.Service' objects.
|
||||||
|
@ -238,6 +238,11 @@ SCHEDULER_CODE_FIELDS={
|
|||||||
'description': 'string'
|
'description': 'string'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SERVICE_FIELDS={
|
||||||
|
'name': 'string',
|
||||||
|
'description': 'string'
|
||||||
|
}
|
||||||
|
|
||||||
class RivWebPyApi_ListHandler(ContentHandler):
|
class RivWebPyApi_ListHandler(ContentHandler):
|
||||||
def __init__(self,base_tag,fields):
|
def __init__(self,base_tag,fields):
|
||||||
self.__output=[]
|
self.__output=[]
|
||||||
@ -441,6 +446,10 @@ class SchedulerCode(RivendellType):
|
|||||||
def __init__(self,values={}):
|
def __init__(self,values={}):
|
||||||
super().__init__(SCHEDULER_CODE_FIELDS,values)
|
super().__init__(SCHEDULER_CODE_FIELDS,values)
|
||||||
|
|
||||||
|
class Service(RivendellType):
|
||||||
|
def __init__(self,values={}):
|
||||||
|
super().__init__(SERVICE_FIELDS,values)
|
||||||
|
|
||||||
class rivwebpyapi(object):
|
class rivwebpyapi(object):
|
||||||
"""
|
"""
|
||||||
Create a 'RivWebPyApi' object for accessing the Web API.
|
Create a 'RivWebPyApi' object for accessing the Web API.
|
||||||
@ -1641,7 +1650,8 @@ class rivwebpyapi(object):
|
|||||||
|
|
||||||
def ListServices(self,trackable):
|
def ListServices(self,trackable):
|
||||||
"""
|
"""
|
||||||
Returns a set of Rivendell services (list of dictionaries).
|
Returns a set of Rivendell services
|
||||||
|
(list of rivwebpyapi.Service objects).
|
||||||
|
|
||||||
Takes one argument:
|
Takes one argument:
|
||||||
|
|
||||||
@ -1674,14 +1684,15 @@ class rivwebpyapi(object):
|
|||||||
#
|
#
|
||||||
# Generate the output dictionary
|
# Generate the output dictionary
|
||||||
#
|
#
|
||||||
fields={
|
handler=RivWebPyApi_ListHandler(base_tag='service',
|
||||||
'name': 'string',
|
fields=SERVICE_FIELDS)
|
||||||
'description': 'string'
|
|
||||||
}
|
|
||||||
handler=RivWebPyApi_ListHandler(base_tag='service',fields=fields)
|
|
||||||
xml.sax.parseString(r.text,handler)
|
xml.sax.parseString(r.text,handler)
|
||||||
|
out=handler.output()
|
||||||
|
ret=[]
|
||||||
|
for item in out:
|
||||||
|
ret.append(Service(item))
|
||||||
|
|
||||||
return handler.output()
|
return ret
|
||||||
|
|
||||||
def ListSystemSettings(self):
|
def ListSystemSettings(self):
|
||||||
"""
|
"""
|
||||||
|
@ -72,6 +72,6 @@ except rivwebpyapi.RivWebPyError as err:
|
|||||||
# Display the services list
|
# Display the services list
|
||||||
#
|
#
|
||||||
for svc in services:
|
for svc in services:
|
||||||
print('name: '+svc['name'])
|
for key in svc.values():
|
||||||
print('description: '+svc['description'])
|
print(key+': '+str(svc.values()[key]))
|
||||||
print('')
|
print('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user