You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
740 B
Python

"""
This interfaces the reader for a data-transport
"""
import cms
import transport
@cms.Plugin(mimetype="application/json",method="POST")
def read(**_args) :
_request = _args['request']
_body = _request.json
_data = {}
try:
reader = transport.get.reader(label = _body['label'])
_query = _body['query']
#
# @TODO :
# - support for mongodb and NoSQL ...
# - limit to 10K
_data = reader.apply(_query)
_data.to_dict(orient='split')
del _data['index']
except Exception as e:
print (e)
return _data
@cms.Plugin(mimetype="application/json")
def write(**_args) :
_request = _args['request']
print (_request.json)
return {}