Complete the code to import the Flask-Limiter extension.
from flask_limiter import [1]
The Flask-Limiter extension is imported using Limiter.
Complete the code to create a Limiter instance with default limits.
limiter = Limiter(app, default_limits=["[1] per minute"])
The example uses a default limit of 5 per minute to protect the app.
Fix the error in the decorator to apply rate limiting on the route.
@limiter.[1]("3 per minute") def home(): return "Welcome!"
The correct decorator method is limit to set rate limits on routes.
Fill both blanks to create a rate limit key function using IP address.
def [2](): return request.[1] limiter = Limiter(app, key_func=[2])
The IP address is accessed via request.remote_addr, and the key function is set to remote_addr.
Fill all three blanks to create a custom error message for rate limit exceeded.
from flask import Flask, jsonify @limiter.[1]("2 per minute") def limited_route(): return jsonify({"message": "[2]"}), [3]
The decorator is limit, the message informs the user, and HTTP status code 429 means too many requests.
