Skip to content
New issue

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

chore: Remove flask limiter warning #6658

Merged
merged 1 commit into from Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/__init__.py
Expand Up @@ -18,6 +18,7 @@
from flask_login import current_user
from flask_jwt_extended import JWTManager
from flask_limiter import Limiter
from flask_limiter.util import get_ipaddr
from datetime import timedelta
from flask_cors import CORS
from flask_rest_jsonapi.errors import jsonapi_errors
Expand Down Expand Up @@ -56,7 +57,7 @@
static_dir = os.path.dirname(os.path.dirname(__file__)) + "/static"
template_dir = os.path.dirname(__file__) + "/templates"
app = Flask(__name__, static_folder=static_dir, template_folder=template_dir)
limiter = Limiter(app)
limiter = Limiter(app, key_func=get_ipaddr)
env.read_envfile()


Expand Down
3 changes: 1 addition & 2 deletions app/api/auth.py
Expand Up @@ -13,7 +13,6 @@
current_user, create_access_token,
create_refresh_token, set_refresh_cookies,
get_jwt_identity)
from flask_limiter.util import get_remote_address
from healthcheck import EnvironmentDump
from sqlalchemy.orm.exc import NoResultFound

Expand Down Expand Up @@ -289,7 +288,7 @@ def resend_verification_email():
'3/hour', key_func=lambda: request.json['data']['email'], error_message='Limit for this action exceeded'
)
@limiter.limit(
'1/minute', key_func=get_remote_address, error_message='Limit for this action exceeded'
'1/minute', error_message='Limit for this action exceeded'
)
def reset_password_post():
try:
Expand Down
3 changes: 1 addition & 2 deletions app/api/custom/orders.py
@@ -1,6 +1,5 @@
from flask import Blueprint, jsonify, request
from flask_jwt_extended import current_user, jwt_required
from flask_limiter.util import get_remote_address
from sqlalchemy.orm.exc import NoResultFound


Expand Down Expand Up @@ -50,7 +49,7 @@ def ticket_attendee_authorized(order_identifier):
'5/minute', key_func=lambda: request.json['data']['user'], error_message='Limit for this action exceeded'
)
@limiter.limit(
'60/minute', key_func=get_remote_address, error_message='Limit for this action exceeded'
'60/minute', error_message='Limit for this action exceeded'
)
def resend_emails():
"""
Expand Down