question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compatibility of Flask-Limiter or a different form of rate limiting?

See original GitHub issue

I’m wondering or anyone has implemented a form of rate limiting that works with a flask-restplus-patched project? Flask-Limiter looks like a really nice project but will probably need some work getting it to work with this project.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
frolcommented, Feb 6, 2019
3reactions
10000TBcommented, Feb 6, 2019

@theveloped what specific issue are you having ?

After adding limiter through extension as you did, a simple snippet like follow works for me for what flask-limiter promised: note: set limiter decorator via decorator variable

from app.extensions import limiter

// .... ignore all other resources

@api.route('/account/verify')
 class IdentityVerify(Resource):
       """
       Handle identity verification.
       """
       decorators = [limiter.limit("10/second")]  # Notice this is different from the simple example
       @api.parameters(parameters.SomeParameters())
       @api.response(schemas.SomeSchema())
       def post(self, args):
            return {"verified": True}

Reference this for more details why decorating functions or class won’t work: https://flask-limiter.readthedocs.io/en/stable/#using-flask-pluggable-views

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flask-Limiter 1.5+2.g5eddb74.dirty documentation
Flask-Limiter comes with three different rate limiting strategies built-in. Pick the one that works for your use-case by specifying it in your flask...
Read more >
Flask-Limiter {2.8.1}
Flask -Limiter provides rate limiting features to Flask applications. By adding the extension to your flask application, you can configure various rate ...
Read more >
flask_limiter.extension - Flask-Limiter {2.8.1} - Read the Docs
:param key_func: a callable that returns the domain to rate limit by. :param default_limits: a variable list of strings or callables returning strings ......
Read more >
Changelog - Flask-Limiter {2.8.1}
Expose option to register a callback for rate limit breaches of default limits via the on_breach constructor parameter · Replace use of flask.g...
Read more >
Rate limiting strategies - Flask-Limiter {2.8.1}
Flask-Limiter comes with three different rate limiting strategies built-in. Pick the one that works for your use-case by specifying it in your flask...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found