def get_single_trace():
    req_data = json.loads(request.data)
    trace_id = req_data['trace_id']
    query_result = LeancloudUtils.get_trace_by_id(trace_id)
    if query_result:
        trace = query_result[0].attributes['senz_data']
        resp = make_response(json.dumps(trace), 200)
        # resp.headers['Access-Control-Allow-Origin'] = '*'
        resp.headers["Access-Control-Allow-Headers"] = "content-type"
        return resp
    else:
        resp = make_response(json.dumps({"code": 1, 'msg': 'trace_id not matched!'}), 400)
        # resp.headers['Access-Control-Allow-Origin'] = '*'
        resp.headers["Access-Control-Allow-Headers"] = "content-type"
        return resp
def get_act_trace(trace_id):
    query_result = LeancloudUtils.get_trace_by_id(trace_id)
    if query_result:
        trace = query_result[0].attributes['senz_data']
        tracelist = []
        for t in trace:
            tracelist.append({'timestamp': t['timestamp'],
                              'location': {
                                  'latitude': t['lat'],
                                  'longitude': t['lng']}
                              })
        resp = make_response(json.dumps({'trace_list': tracelist, 'code': 0}), 200)
        # resp.headers['Access-Control-Allow-Origin'] = '*'
        resp.headers["Access-Control-Allow-Headers"] = "content-type"
        return resp
    else:
        resp = make_response(json.dumps({"code": 1, 'msg': 'trace_id not matched!'}), 400)
        # resp.headers['Access-Control-Allow-Origin'] = '*'
        resp.headers["Access-Control-Allow-Headers"] = "content-type"
        return resp
    pass