Skip to content

Commit

Permalink
Fix flask api limiter isseu
Browse files Browse the repository at this point in the history
  • Loading branch information
tae898 committed Nov 30, 2021
1 parent fda1b39 commit c166e64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/conceptnet_web/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import flask
from flask_cors import CORS
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address

from conceptnet5 import api as responses
from conceptnet5.api import VALID_KEYS, error
Expand Down Expand Up @@ -37,7 +38,8 @@ def app_path(path):
for filter_name, filter_func in FILTERS.items():
app.jinja_env.filters[filter_name] = filter_func
app.jinja_env.add_extension('jinja2_highlight.HighlightExtension')
limiter = Limiter(app, global_limits=["600 per minute", "6000 per hour"])
limiter = Limiter(app, key_func=get_remote_address,
global_limits=["600 per minute", "6000 per hour"])
CORS(app)
try_configuring_sentry(app)
application = app # for uWSGI
Expand Down

0 comments on commit c166e64

Please sign in to comment.