#coding=utf-8

import tornado.web
from tornado.escape import json_encode,json_decode
import utils.common_util as common_util
import utils.result_view_util as result_utils 
# 导入人数检测模块
# import ....


class FaceCountHandler(tornado.web.RequestHandler):
	

	def set_default_headers(self):
        # 设置请求头
		self.set_header('Content-Type', 'application/json')

	def post(self):
		request_body = json_decode(self.request.body)
		if not result_utils.is_valid_json(result_utils.get_require_data(),request_body):
			self.write(json_encode(result_utils.error('20004')))
			return
		if common_util.valid_file_size(request_body['file']['data'],2):	
			img_arr = common_util.base64_2_array(request_body['file']['data'])
			print(img_arr,type(img_arr))
			# 
			# 将img_arr 传入 ’检测函数‘
			# 将输出的检测结果(假如名为detect_result)作为参数 传入下方success函数
			#  result = result_utils.success(detect_result)
			#
			detect_result = {}
			result = result_utils.success(detect_result)

			self.write(json_encode(result))
		else:
			self.write(json_encode(result_utils.error('20006')))


class ErrorHandler(tornado.web.RequestHandler):

	def set_default_headers(self):
        # 设置请求头
		self.set_header('Content-Type', 'application/json')

	def get(self,_):
		# self.set_statues(404)
		self.write(json_encode(result_utils.error('20009')))



2223e7ec264734fb17664f95592f4803236c7ade
<mask token>


class FaceCountHandler(tornado.web.RequestHandler):
    <mask token>
    <mask token>


class ErrorHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def get(self, _):
        self.write(json_encode(result_utils.error('20009')))

<mask token>


class FaceCountHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')
    <mask token>


class ErrorHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def get(self, _):
        self.write(json_encode(result_utils.error('20009')))

<mask token>


class FaceCountHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def post(self):
        request_body = json_decode(self.request.body)
        if not result_utils.is_valid_json(result_utils.get_require_data(),
            request_body):
            self.write(json_encode(result_utils.error('20004')))
            return
        if common_util.valid_file_size(request_body['file']['data'], 2):
            img_arr = common_util.base64_2_array(request_body['file']['data'])
            print(img_arr, type(img_arr))
            detect_result = {}
            result = result_utils.success(detect_result)
            self.write(json_encode(result))
        else:
            self.write(json_encode(result_utils.error('20006')))


class ErrorHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def get(self, _):
        self.write(json_encode(result_utils.error('20009')))

import tornado.web
from tornado.escape import json_encode, json_decode
import utils.common_util as common_util
import utils.result_view_util as result_utils


class FaceCountHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def post(self):
        request_body = json_decode(self.request.body)
        if not result_utils.is_valid_json(result_utils.get_require_data(),
            request_body):
            self.write(json_encode(result_utils.error('20004')))
            return
        if common_util.valid_file_size(request_body['file']['data'], 2):
            img_arr = common_util.base64_2_array(request_body['file']['data'])
            print(img_arr, type(img_arr))
            detect_result = {}
            result = result_utils.success(detect_result)
            self.write(json_encode(result))
        else:
            self.write(json_encode(result_utils.error('20006')))


class ErrorHandler(tornado.web.RequestHandler):

    def set_default_headers(self):
        self.set_header('Content-Type', 'application/json')

    def get(self, _):
        self.write(json_encode(result_utils.error('20009')))

#coding=utf-8

import tornado.web
from tornado.escape import json_encode,json_decode
import utils.common_util as common_util
import utils.result_view_util as result_utils 
# 导入人数检测模块
# import ....


class FaceCountHandler(tornado.web.RequestHandler):
	

	def set_default_headers(self):
        # 设置请求头
		self.set_header('Content-Type', 'application/json')

	def post(self):
		request_body = json_decode(self.request.body)
		if not result_utils.is_valid_json(result_utils.get_require_data(),request_body):
			self.write(json_encode(result_utils.error('20004')))
			return
		if common_util.valid_file_size(request_body['file']['data'],2):	
			img_arr = common_util.base64_2_array(request_body['file']['data'])
			print(img_arr,type(img_arr))
			# 
			# 将img_arr 传入 ’检测函数‘
			# 将输出的检测结果(假如名为detect_result)作为参数 传入下方success函数
			#  result = result_utils.success(detect_result)
			#
			detect_result = {}
			result = result_utils.success(detect_result)

			self.write(json_encode(result))
		else:
			self.write(json_encode(result_utils.error('20006')))


class ErrorHandler(tornado.web.RequestHandler):

	def set_default_headers(self):
        # 设置请求头
		self.set_header('Content-Type', 'application/json')

	def get(self,_):
		# self.set_statues(404)
		self.write(json_encode(result_utils.error('20009')))


