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]

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.

The URI endpoints are:

/api/comms
Download the entire communications log
/api/comms/<pass_id>
Download a specific pass

Valid parameters are:

format output format: json / csv / html
N max number of entries to return. Omit for all
Usage:
>>> api = RESTAPI()
>>> api.start()
Parameters:
  • commslog (CommsLog) – Database end-point for comms log
  • 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)
  • allowed (list(str)) – LIst of allowed URI patterns. Default is None, which actually means all
  • debug (bool) – Set flask in Debug mode for extra verbosity

Methods

start()
stop()