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

limiter fails #317

Open
tae898 opened this issue Nov 30, 2021 · 6 comments · May be fixed by #318
Open

limiter fails #317

tae898 opened this issue Nov 30, 2021 · 6 comments · May be fixed by #318

Comments

@tae898
Copy link

tae898 commented Nov 30, 2021

I'm currently testing the master branch. When I start api.py, below error message appears.

Traceback (most recent call last):
  File "conceptnet_web/api.py", line 40, in <module>
    limiter = Limiter(app, global_limits=["600 per minute", "6000 per hour"])
  File "/usr/local/lib/python3.7/site-packages/flask_limiter/extension.py", line 153, in __init__
    assert key_func
AssertionError
@amirouche
Copy link
Contributor

What is the actual version of flask_limiter, check out with pip freeze | grep flask-limiter.

re flask limiter: #308

@tae898 tae898 linked a pull request Nov 30, 2021 that will close this issue
@tae898
Copy link
Author

tae898 commented Nov 30, 2021

These are the versions

Flask==2.0.2
Flask-Cors==3.0.10
Flask-Limiter==2.0.2

@tae898
Copy link
Author

tae898 commented Nov 30, 2021

@amirouche I've made a PR:

#318

@tae898
Copy link
Author

tae898 commented Nov 30, 2021

Flask-Limiter==2.0.2 was released 2 days ago:

https://pypi.org/project/Flask-Limiter/

@basels
Copy link

basels commented Jun 3, 2022

You can use the latest Flask-Limiter but it requires the following changes in file conceptnet_web/api.py:
[add to imports] from flask_limiter.util import get_remote_address
[change line 41 to -->] limiter = Limiter(app, key_func=get_remote_address, default_limits=["600 per minute", "6000 per hour"])

@tae898
Copy link
Author

tae898 commented Jun 3, 2022

@basels

Thanks for the heads-up!
I just froze the version in my docker implementation:

https://github.com/tae898/conceptnet5/blob/develop/web/setup.py:

install_requires=[
    'conceptnet >= %s' % version_str,
    'limits', 'flask >= 2.0.2', 'flask-cors >=3.0.10', 'flask-limiter == 2.0.2',
    'langcodes >= 2.1', 'jinja2-highlight', 'pygments', 'raven[flask] >= 6.6'
],
license = 'Apache License 2.0',

and
https://github.com/tae898/conceptnet5/blob/master/Dockerfile

RUN git clone --single-branch --branch develop https://github.com/tae898/conceptnet5.git

It works atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants