in DRF docs there is a page about throttling api requests, I wanted to create a custom throttle class, to make something like twitter api (in twitter api direct user/passwords can make less requests/min compared to oauth requests)
my problem is how to find out which authentication class was used in current request?
答案 0 :(得分:1)
阅读代码,我在请求中看到了DRF stores the authenticator instance。所以我猜你可以这样做:
if type(request._authenticator).__name__ == "TokenAuthentication":
或类似的东西
希望这有帮助