示例#1
0
def get_time(request):
    """
    :param request:  request html
    :return: now time by return json
    """

    now_time = apitimer.get_real_time()

    return HttpResponse(json.dumps({"time": now_time}), content_type="application/json")
示例#2
0
def get_info(request):
    # Get temp
    # logger.debug(apitimer.get_full_unit_now_time())
    temp_float = controldev.get_temp()
    status_list = controldev.get_all_device_status()
    # logger.debug(apitimer.get_full_unit_now_time())
    now_time = apitimer.get_real_time()
    # Return json
    return HttpResponse(json.dumps({'time': now_time, 'temp': temp_float, 'dev': status_list}),
                        content_type="application/json")