Reputation: 5720
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?
Upvotes: 0
Views: 239
Reputation: 20102
Reading the code I saw that DRF stores the authenticator instance on the request. So i guess you can do something like:
if type(request._authenticator).__name__ == "TokenAuthentication":
or something like that
Hope this helps
Upvotes: 1