摘要:
jwt=Json Web token #原理 """ 1)jwt分三段式:头.体.签名 (head.payload.sgin) 2)头和体是可逆加密,让服务器可以反解出user对象;签名是不可逆加密,保证整个token的安全性的 3)头体签名三部分,都是采用json格式的字符串,进行加密,可逆加密一 阅读全文
posted @ 2022-04-08 01:47
咖喱给给啊
阅读(53)
评论(0)
推荐(0)
摘要:
# 1 安装:pip install coreapi # 2 在路由中配置 from rest_framework.documentation import include_docs_urls urlpatterns = [ ... path('docs/', include_docs_urls(t 阅读全文
posted @ 2022-04-08 01:46
咖喱给给啊
阅读(35)
评论(0)
推荐(0)
摘要:
# 写一个类,继承SimpleRateThrottle,只需要重写get_cache_key from rest_framework.throttling import ScopedRateThrottle,SimpleRateThrottle #继承SimpleRateThrottle class 阅读全文
posted @ 2022-04-08 01:45
咖喱给给啊
阅读(32)
评论(0)
推荐(0)
摘要:
# 自定制频率类,需要写两个方法 -# 判断是否限次:没有限次可以请求True,限次了不可以请求False def allow_request(self, request, view): -# 限次后调用,显示还需等待多长时间才能再访问,返回等待的时间seconds def wait(self): 阅读全文
posted @ 2022-04-08 01:45
咖喱给给啊
阅读(23)
评论(0)
推荐(0)
摘要:
# urls.py from django.urls import path,re_path from api import views urlpatterns = [ path('books/', views.BookAPIView.as_view()), re_path('books/(?P<p 阅读全文
posted @ 2022-04-08 01:43
咖喱给给啊
阅读(26)
评论(0)
推荐(0)
摘要:
#views.py # 查所有,才需要分页 from rest_framework.generics import ListAPIView # 内置三种分页方式 from rest_framework.pagination import PageNumberPagination,LimitOffse 阅读全文
posted @ 2022-04-08 01:43
咖喱给给啊
阅读(21)
评论(0)
推荐(0)
浙公网安备 33010602011771号