接口中不需要登录的接口@base_request

def base_request(sub_post):
def inner(self, request):
if request.method == 'POST':
if request.content_type == 'application/json':
body = request.body.decode('utf-8')
if body == '':
json_data = {}
else:
json_data = json.loads(body)
else:
json_data = request.POST
else:
json_data = request.GET
return sub_post(self, request, json_data)
return inner

猜你喜欢

转载自www.cnblogs.com/meili970202/p/11283856.html