def notes_detail(key):

    mongodb = Gimnasio.Notes()

    if request.method == 'PUT':
        note = request.data
        mongodb.update(key, note)
        return note

    elif request.method == 'DELETE':
        mongodb.delete(key)
        return '', status.HTTP_204_NO_CONTENT

    # request.method == 'GET'
    note = mongodb.findOne(key)
    if not note:
        raise exceptions.NotFound()
    else:
        return note

    return jsonify(key)
def list():
    redis = Accounts.Sessions()

    now = datetime.now()

    timestamp = datetime.timestamp(now)

    #redis.add(timestamp)

    mongodb = Gimnasio.Notes()

    if request.method == 'POST':
        note = request.data

        result = mongodb.create(note)

        # Se adiciono para poder manejar ObjectID
        note['_id'] = str(note['_id'])

        return note, status.HTTP_201_CREATED

    return mongodb.find()