def token_verify(self): self.Token = self.request.headers.get('X-XSRFToken') if not self.Token: raise ParamException('X-XSRFToken') self.tag = self.request.headers.get('tag') if not self.tag: raise ParamException('params') verify = getToken() # print self.Token, self.tag data = verify.get_token(self.Token, self.tag) if not data: raise BaseException(BaseError.ERROR_COMMON_ACCESS_DENIED)
def _parse_request(self): # json解析 try: json_body = json.loads(self.request.body) print json_body except: raise BaseException(BaseError.ERROR_COMMON_PARSE_JSON_FAILED) # 设定参数字典 self.params['tag'] = json_body.get('tag') # print self.params if not verify_utils.is_dict(self.params): raise ParamException('params')
def _parse_request(self): # json解析 try: # print self.request.body # print self.request.body_arguments # print type(self.request.body) json_body = json.loads(self.request.body) # print json_body except: raise BaseException(BaseError.ERROR_COMMON_PARSE_JSON_FAILED) # self.params = json_body.get('chn_id') self.params['chn_id'] = json_body.get('chn_id') # print self.params if not verify_utils.is_dict(self.params): raise ParamException('chn_id')
def _parse_request(self): # json解析 try: json_body = json.loads(self.request.body) # print json_body except: raise BaseException(BaseError.ERROR_COMMON_PARSE_JSON_FAILED) # 设定参数字典 self.params['api_name'] = json_body.get('api_name') self.params['name'] = json_body.get('name') self.params['resp_callback_url'] = json_body.get('resp_callback_url') self.params['resp_callback_token'] = json_body.get( 'resp_callback_token') self.params['is_pulled'] = json_body.get('is_pulled') # print self.params if not verify_utils.is_dict(self.params): raise ParamException('params')
def _parse_request(self): # json解析 try: json_body = json.loads(self.request.body) # print json_body except: raise BaseException(BaseError.ERROR_COMMON_PARSE_JSON_FAILED) # 设定参数字典 self.params['app_name'] = json_body.get('app_name') self.params['pkg_name'] = json_body.get('pkg_name') self.params['category'] = json_body.get('category') self.params['platform'] = json_body.get('platform') self.params['url'] = json_body.get('url') self.params['description'] = json_body.get('description') self.params['chn_id'] = json_body.get('chn_id') # print self.params if not verify_utils.is_dict(self.params): raise ParamException('params')
def _parse_request(self): # headers 匹配 try: headers = self.request.headers if re.search(ur'(iPhone)', str(headers)) or re.search( ur'(Android)', str(headers)): # json解析 try: json_body = json.loads(self.request.body) # print json_body except: raise BaseException( BaseError.ERROR_COMMON_PARSE_JSON_FAILED) # 设定参数字典 self.params['offer_id'] = json_body.get('offer_id') self.params['app_id'] = json_body.get('app_id') self.params['app_click_id'] = json_body.get('app_click_id') self.params['pid'] = json_body.get('pid') # print self.params if not verify_utils.is_dict(self.params): raise ParamException('params') else: