Django Rest Framework(认证、权限、限制访问频率)
一、 认证和授权 a. 用户url传入的token认证 from django.conf.urls import url, include from web.viewsimport TestView urlpatterns = [ url(r ' ^test/ ' , TestView.as_view()), ] urls.py # !/usr/bin/env python # -*- coding:utf-8 -*- from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.authentication import BaseAuthentication from rest_framework.permissions import BasePermission from rest_framework.request import Request from rest_framework import exceptions token_list = [ ' sfsfss123kuf3j123 ' , ' asijnfowerkkf9812 ' , ] class TestAuthentication