We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, is there a way to change the default message in the throttle response to remove the time remaining message?
For example, instead of this:
{ "detail": "Request was throttled. Expected available in 53 seconds." }
A way to customize it to this:
{ "detail": "Too many requests. Please try again later." }
Potential implementation:
class User6MinRateThrottle(UserRateThrottle): """User 6 per min. rate limit.""" rate = "6/min" scope = "minutes" def throttle_response(self, request, response): if response.status_code = 429: return JsonResponse({"detail": "Too many requests. Please try again later."}, status=429) return response @api_controller("shop/", throttle=[User6MinRateThrottle()]) class ProductController: """Product API controller.""" @route.post("/product") def create_product( self, payload: ProductCreateSchema, ) -> dict: """Create product API endpoint.""" product = Product.objects.create( name=payload.name, description=payload.description, price=payload.price, ) return { "id": product.id, "name": product.name, "description": product.description, "price": product.price, }
The text was updated successfully, but these errors were encountered:
@tmorgan497 You may have to create this ticket on django-ninja repo. because the base class for Throttling have been moved to django-ninja repo.
Sorry, something went wrong.
No branches or pull requests
Hi, is there a way to change the default message in the throttle response to remove the time remaining message?
For example, instead of this:
A way to customize it to this:
Potential implementation:
The text was updated successfully, but these errors were encountered: