-
-
Save kaniket7209/9005231aa04dd65c66523f4803553586 to your computer and use it in GitHub Desktop.
What is flask-limiter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What will happen if the rate limit strings that are provided to the Limiter.limit() decorator are malformed and can’t be parsed ? | |
Answer: Then the decorated route will fall back to the default rate limit(s) and an ERROR log message will be emitted. | |
2. What is exemption condition? | |
Answee: Each limit can be exempted when given conditions are fulfilled. These conditions can be specified by supplying a callable as an `exempt_when` argument when defining the limit. | |
3. What is key_func ? | |
Answer: key_func is a callable that returns the domain to rate limit by. | |
4. What is exempt? | |
Answer: Exempt is a decorator to mark a view or all views in a blueprint as exempt from rate limits. | |
5. What is the default rate limit that is applied to all routes? | |
Answer: A default rate limit of 200 per day, and 50 per hour is applied to all routes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Choose the correct command to install flask-limiter extension | |
a) pip install flask-limiter | |
b) npm install flask-limiter | |
c) pip install flask limiter | |
d) pip install flask_limiter | |
Answer: a) | |
2. What is the use of get_remote_address() function? | |
a) it stores the response from the user | |
b) it stores the IP address of the user of the reponse | |
c) it uses the remote_address of the request | |
d) All of the above | |
Answer: c) | |
3. Which of the following is not he decorator | |
a) Limiter.limit() | |
b) Limiter.shared_limit() | |
c) Limiter.exempt() | |
d) Limiter.filter() | |
Answer: d) | |
4. Shared limits provides ______ convenience as individual rate limits. | |
a) different | |
b) same | |
c) both a and b | |
d) None the above | |
Answer: b) | |
5. Choose the correct string notation for rate limit | |
a) 10 per hour | |
b) 10/hour;100/day;2000 per year | |
c) 100/day, 500/7days | |
d) All of thr above | |
Answer: d) | |
6. What is the correct command to import flask-limiter extension | |
a) from flask limiter import Limiter | |
b) from flask_limiter import Limiter | |
c) from flask-limiter import limiter | |
d) from flask_limiter import limiter | |
Answer: b) | |
7. Choose thecorrect commmand to import get_remote_address | |
a) from flask_limiter.util import get_remote_address | |
b) from flask.util import get_remote_address | |
c) from flask import get_remote_address | |
d) from flask-limiter.util import get_remote_address | |
Answer: a) | |
8. The key function is called from _______ a flask request context. | |
a) outside | |
b) inside | |
c) within | |
d) None of the above | |
Answer: c) | |
9. is this statememt correct or not? | |
The provided callable will be called for every request on the decorated route. | |
a) True | |
b) False | |
Answer: a) | |
10. Which of the following statement is correct about check() | |
a) check the limits for all responses | |
b) check the limits for the current response | |
c) check the limits for the current request | |
d) check the limits for only final request | |
Answer: c) | |
11. flask-limiter is a | |
a) API | |
b) extension | |
c) both API and extension | |
d) None of the above | |
Answer: b) | |
12. can we make our custom error message rather provided by default | |
a) Yes | |
b) No | |
Answer: a) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment