mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-30 01:00:18 +01:00
2021-11-08 Fred Gleason <fredg@paravelsystems.com>
* Changed the name of the 'RivWebPyApi' to 'rivwebpyapi'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -22581,3 +22581,5 @@
|
|||||||
2021-11-07 Fred Gleason <fredg@paravelsystems.com>
|
2021-11-07 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Removed 'xmltodict' Python module dependency to the 'rivwebpyapi'
|
* Removed 'xmltodict' Python module dependency to the 'rivwebpyapi'
|
||||||
API.
|
API.
|
||||||
|
2021-11-08 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Changed the name of the 'RivWebPyApi' to 'rivwebpyapi'.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# pypad.py
|
# rivwebpyapi.py
|
||||||
#
|
#
|
||||||
# Python binding for the Rivendell Web API
|
# Python3 binding for the Rivendell Web API
|
||||||
#
|
#
|
||||||
# (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
# (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
#
|
#
|
||||||
@@ -98,7 +98,7 @@ class RivWebPyApi_ListHandler(ContentHandler):
|
|||||||
month=int(f0[1]),
|
month=int(f0[1]),
|
||||||
day=int(f0[2]));
|
day=int(f0[2]));
|
||||||
|
|
||||||
class RivWebPyApi(object):
|
class rivwebpyapi(object):
|
||||||
"""
|
"""
|
||||||
Create a 'RivWebPyApi' object for accessing the Web API.
|
Create a 'RivWebPyApi' object for accessing the Web API.
|
||||||
"""
|
"""
|
||||||
@@ -201,7 +201,7 @@ class RivWebPyApi(object):
|
|||||||
|
|
||||||
def ListServices(self,trackable):
|
def ListServices(self,trackable):
|
||||||
"""
|
"""
|
||||||
Returns a list of Rivendell services (Element).
|
Returns a list of Rivendell services (dictionary).
|
||||||
|
|
||||||
Takes one argument:
|
Takes one argument:
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,14 @@ recent=False
|
|||||||
#
|
#
|
||||||
# Get login parameters
|
# Get login parameters
|
||||||
#
|
#
|
||||||
usage='list_logs --url=<rd-url> --username=<rd-username> [--password=<passwd>]'
|
usage='list_logs --url=<rd-url> --username=<rd-username> [--password=<passwd>] [--recent] [--trackable] [--service-name=<name>] [--log-name=<name>] [--filter-string=<str>]'
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
f0=arg.split('=')
|
f0=arg.split('=')
|
||||||
|
if(len(f0)==1):
|
||||||
|
if(f0[0]=='--recent'):
|
||||||
|
recent=True
|
||||||
|
if(f0[0]=='--trackable'):
|
||||||
|
trackable=True
|
||||||
if(len(f0)==2):
|
if(len(f0)==2):
|
||||||
if(f0[0]=='--url'):
|
if(f0[0]=='--url'):
|
||||||
url=f0[1]
|
url=f0[1]
|
||||||
@@ -52,12 +57,8 @@ for arg in sys.argv:
|
|||||||
service_name=f0[1]
|
service_name=f0[1]
|
||||||
if(f0[0]=='--log-name'):
|
if(f0[0]=='--log-name'):
|
||||||
log_name=f0[1]
|
log_name=f0[1]
|
||||||
if(f0[0]=='--trackable'):
|
|
||||||
trackable=True
|
|
||||||
if(f0[0]=='--filter-string'):
|
if(f0[0]=='--filter-string'):
|
||||||
filter_string=f0[1]
|
filter_string=f0[1]
|
||||||
if(f0[0]=='--recent'):
|
|
||||||
recent=True
|
|
||||||
if(not password):
|
if(not password):
|
||||||
password=getpass.getpass()
|
password=getpass.getpass()
|
||||||
if((not url)or(not username)):
|
if((not url)or(not username)):
|
||||||
@@ -67,7 +68,7 @@ if((not url)or(not username)):
|
|||||||
#
|
#
|
||||||
# Get the log list
|
# Get the log list
|
||||||
#
|
#
|
||||||
webapi=rivwebpyapi.RivWebPyApi(url=url,username=username,password=password)
|
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
|
||||||
logs=webapi.ListLogs(service_name=service_name,log_name=log_name,
|
logs=webapi.ListLogs(service_name=service_name,log_name=log_name,
|
||||||
trackable=trackable,filter_string=filter_string,
|
trackable=trackable,filter_string=filter_string,
|
||||||
recent=recent)
|
recent=recent)
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ password=''
|
|||||||
trackable=False
|
trackable=False
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
f0=arg.split('=')
|
f0=arg.split('=')
|
||||||
|
if(len(f0)==1):
|
||||||
|
if(f0[0]=='--trackable'):
|
||||||
|
trackable=True
|
||||||
if(len(f0)==2):
|
if(len(f0)==2):
|
||||||
if(f0[0]=='--url'):
|
if(f0[0]=='--url'):
|
||||||
url=f0[1]
|
url=f0[1]
|
||||||
@@ -43,8 +46,6 @@ for arg in sys.argv:
|
|||||||
username=f0[1]
|
username=f0[1]
|
||||||
if(f0[0]=='--password'):
|
if(f0[0]=='--password'):
|
||||||
password=f0[1]
|
password=f0[1]
|
||||||
if(f0[0]=='--trackable'):
|
|
||||||
trackable=True
|
|
||||||
if(not password):
|
if(not password):
|
||||||
password=getpass.getpass()
|
password=getpass.getpass()
|
||||||
if((not url)or(not username)):
|
if((not url)or(not username)):
|
||||||
@@ -54,7 +55,7 @@ if((not url)or(not username)):
|
|||||||
#
|
#
|
||||||
# Get the services list
|
# Get the services list
|
||||||
#
|
#
|
||||||
webapi=rivwebpyapi.RivWebPyApi(url=url,username=username,password=password)
|
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
|
||||||
services=webapi.ListServices(trackable=trackable)
|
services=webapi.ListServices(trackable=trackable)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user