Bird
0
0

Which of the following is the correct syntax to apply a rate limit of 5 requests per minute to a Flask route using Flask-Limiter?

easy📝 Syntax Q3 of 15
Flask - Security Best Practices
Which of the following is the correct syntax to apply a rate limit of 5 requests per minute to a Flask route using Flask-Limiter?
A@limiter.limit('5 requests per minute')
B@limiter.limit(5, 'minute')
C@limiter.limit('minute 5')
D@limiter.limit('5 per minute')
Step-by-Step Solution
Solution:
  1. Step 1: Recall Flask-Limiter syntax for limits

    The limit decorator uses a string like '5 per minute' to specify rate limits.
  2. Step 2: Identify correct format

    @limiter.limit('5 per minute') matches the correct string format; others are invalid syntax.
  3. Final Answer:

    @limiter.limit('5 per minute') -> Option D
  4. Quick Check:

    Correct syntax = '@limiter.limit('5 per minute')' [OK]
Quick Trick: Use string format 'X per Y' for rate limits [OK]
Common Mistakes:
MISTAKES
  • Using tuple or separate arguments incorrectly
  • Reversing order of time and count
  • Adding extra words like 'requests'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes