示例#1
0
def insert_data():
    temp_range = [i for i in range(0, 110)]
    from random import choice

    for i in range(1):
        payload = {
            'method': 'insert',
            'payload': {
                'temperature': choice(temp_range),
                'city': 'Pune'
            }
        }
        resp = TempTracker().controller(**payload)
        print(resp)
示例#2
0
def temperature_get_mean():
    """
    Temperature to get minimum temperature from database
    :return:
    """
    response = {}

    if request.method == 'GET':
        response = TempTracker().controller(**{
            'method': 'get_mean',
            'payload': {},
            'response': 'flask_resp'
        })

    return jsonify(**response)
示例#3
0
def temperature():
    """
    Temperature API for POST, GET, PUT, DELETE
    :return:
    """
    response = {}
    print('test')
    if request.method == 'POST':
        payload = jsonify_request(request)
        response = TempTracker().controller(**{
            'method': 'insert',
            'payload': payload,
            'response': 'flask_resp'
        })

    return jsonify(**response)
示例#4
0
def get_mean():
    payload = {'method': 'get_mean'}
    resp = TempTracker().controller(**payload)
    print(resp)
示例#5
0
def get_max():
    payload = {'method': 'get_max', 'response': 'flask_resp'}
    resp = TempTracker().controller(**payload)
    print(resp)