Exemplo n.º 1
0
def add_schedule():
    """
    Add a schedule.
    Returns:

    """
    schedules_model = SchedulesModel()
    schedules_model.Schedule = {
        'dtype': request.json['dtype'],
        'Corder': request.json['Corder'],
        'Shape': request.json['Shape'],
        '__ndarray__': request.json['__ndarray__']
    }

    schedules_model.Name = request.json['name']
    schedules_model.Timezone = request.json['timezone']
    schedules_model.key = ndb.Key('SchedulesModel', request.json['name'])
    schedules_model.put()
    return 'ok', 200
Exemplo n.º 2
0
def add_schedule():
    """
    Add a schedule.
    Returns:

    """
    with client.context():
        schedules_model = SchedulesModel()
        schedules_model.Schedule = {
            "dtype": request.json["dtype"],
            "Corder": request.json["Corder"],
            "Shape": request.json["Shape"],
            "__ndarray__": request.json["__ndarray__"],
        }

        schedules_model.Name = request.json["name"]
        schedules_model.Timezone = request.json["timezone"]
        schedules_model.key = ndb.Key("SchedulesModel", request.json["name"])
        schedules_model.put()
    return "ok", 200