drf的throttle设置api的访问速率

drf的throttle设置api的访问速率,在setting中设置,登录用户和匿名用户的请求频率做限制,限制单位天、时、分等都可以

在views中:

from rest_framework.throttling import UserRateThrottle,AnonRateThrottle

 

视图类中

throttle_class = (UserRateThrottle,AnonRateThrottle)

posted @ 2017-11-11 22:31  mlj0503  阅读(326)  评论(0编辑  收藏  举报