django-ratelimit
django-ratelimit copied to clipboard
Annotate request and exception with usage data
This can e.g. be inspected by Django's exception handler to give an API user feedback about how long to wait until they may try again.
Usage data will be available as:
-
request.usage -
<settings.RATELIMIT_EXCEPTION_CLASS>().usage
So inside my view or exception handler I could format time_left into a more helpful feedback text for the users of my API.