Exemple #1
0
 def post(buf):
     try:
         in_json_raw, in_data = decode_json_and_data(buf)
         out_json_raw, out_data = server.handle_json_post(in_json_raw, in_data)
         encode_json_and_data(buf, out_json_raw, out_data,
                              throw_exceptions=False)
     except Exception as e:
         encode_json_and_data(buf, json.dumps(
             {"error": str(e), "inner_bt": traceback.format_exc()}
         ), np.zeros(0, dtype=np.uint8), throw_exceptions=False)
Exemple #2
0
 def post(buf):
     try:
         in_json_raw, in_data = decode_json_and_data(buf)
         out_json_raw, out_data = server.handle_json_post(
             in_json_raw, in_data)
         encode_json_and_data(buf,
                              out_json_raw,
                              out_data,
                              throw_exceptions=False)
     except Exception as e:
         encode_json_and_data(buf,
                              json.dumps({"error": str(e)}),
                              np.zeros(0, dtype=np.float32),
                              throw_exceptions=False)
Exemple #3
0
 def handle_post(self, in_json_raw, in_data):
     out_json_raw, out_data = server.handle_json_post(in_json_raw, in_data)
     return out_json_raw.encode("utf-8"), out_data