Bird
0
0

Given this Flask route with rate limiting:

medium📝 component behavior Q4 of 15
Flask - Security Best Practices
Given this Flask route with rate limiting:
@app.route('/data')
@limiter.limit('3 per minute')
def data():
    return 'Data accessed'

What happens if a client sends 4 requests within one minute?
AThe server crashes due to too many requests
BThe first 3 requests succeed; the 4th returns a 429 Too Many Requests error
COnly the 4th request succeeds; the first 3 are blocked
DAll 4 requests succeed without any error
Step-by-Step Solution
Solution:
  1. Step 1: Understand the limit of 3 per minute

    The decorator allows only 3 requests per client per minute.
  2. Step 2: Predict behavior on 4th request

    The 4th request exceeds the limit and triggers a 429 error response.
  3. Final Answer:

    The first 3 requests succeed; the 4th returns a 429 Too Many Requests error -> Option B
  4. Quick Check:

    Requests over limit = 429 error [OK]
Quick Trick: Requests over limit get 429 error response [OK]
Common Mistakes:
MISTAKES
  • Assuming all requests succeed
  • Thinking the server crashes
  • Believing only the last request succeeds

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes