drf的throttle设置api的访问速率

Posted maxiaohei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了drf的throttle设置api的访问速率相关的知识,希望对你有一定的参考价值。

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

在views中:

from rest_framework.throttling import UserRateThrottle,AnonRateThrottle

 

视图类中

throttle_class = (UserRateThrottle,AnonRateThrottle)

以上是关于drf的throttle设置api的访问速率的主要内容,如果未能解决你的问题,请参考以下文章