Ejemplo n.º 1
0
def grab():

    uid_ = request.args.get('uid')
    d_ = request.args.get('date')


    result = mh().grab(uid_, d_)
    content = {"Occurrences by given day": result}

    if result:
        resp = make_response(json.dumps(content), 200)
    else:
        resp = make_response(json.dumps(content), 400)
    return resp
Ejemplo n.º 2
0
def store():


    data  = request.get_json()
    tmp = {k.encode('utf-8'):v.encode('utf-8') for k,v in data.iteritems()}

    result = mh().store(tmp)

    if result:
        content = {"Success": "Document stored sucessfully"}
        resp = make_response(json.dumps(content), 200)
    else:
        content = {"Failure": "Checksum is not correct"}
        resp = make_response(json.dumps(content), 400)
    return resp