标签:sse patch strong isp set 认证 不同 war dump
restful规范:
根据method不同做不同的操作
url: http://api/user
method:
get
post
delete
put
www.cmdb.com/api/v1/asset?page=2&per_page=100
认证
from django.shortcuts import render,HttpResponse
# Create your views here.
from rest_framework.views import APIView
from rest_framework import exceptions
import json
class MyAuthentication(object):
def authenticate(self,request):
token = request._request.GET.get(‘token‘)
if not token:
raise exceptions.AuthenticationFailed(‘用户认证失败‘)
def authenticate_header(self,val):
pass
class Asset(APIView):
authentication_classes = [MyAuthentication,]
def get(self,request,*args,**kwargs):
self.dispatch
ret = {
"code":200,
"msg":"认证成功"
}
return HttpResponse(json.dumps(ret))
标签:sse patch strong isp set 认证 不同 war dump
原文地址:https://www.cnblogs.com/hongpeng0209/p/9060500.html