libgs.restapi.RESTAPI¶
-
class
libgs.restapi.
RESTAPI
(commslog=None, monlog=None, passdb=None, host='localhost', port=8080, default_format='json', rpcapi=None, allowed=None, retry_rpc_conn=True, debug=True)[source]¶ THE REST API class.
Will create a RESTFUL API interface to the Commslog database and start it on a specified port. The api will be started in a separate thread.
Usage:
>>> api = RESTAPI() >>> api.start()
The help will be automatically generated and is available on the endpoint
/api
after creation. Seerestapi
for more details.Parameters: - commslog (
CommsLog
) – Database specification string for comms database - monlog (
MonitorDb
) –Database specification string for monitoring db
- passdb (
PassDb
) –Database specification string for passes db
- host (str) – Ip address to bind to
- port (int) – Port to bind to
- default_format (str) – Format to provide if no argument given (default = json)
- rpcapi (dict) – Dictionary of endpoint:url for XMLRPC APIs to map.
- allowed (list(str)) – LIst of allowed URI patterns. Default is None, which actually means all
- retry_rpc_conn (bool) – If a mapped XMLRPC API is not available, retry connection at regular intervals.
- debug (bool) – Set flask in Debug mode for extra verbosity
Methods
start
()Start the REST API (in a separate thread) stop
()Stop the REST API Inherited from base class
- commslog (