Giter Site home page Giter Site logo

falcon-ratelimit's People

Contributors

ivymarkwell avatar piotrmaslanka avatar xakiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

falcon-ratelimit's Issues

falcon-ratelimit 1.1 is broken with falcon 2.0.0

FYI, looks like falcon-ratelimit==1.1 is broken with the latest version of falcon, which is falcon==2.0.0

❯ gunicorn hello.app:api
[2019-05-24 14:10:19 -0300] [16138] [INFO] Starting gunicorn 19.9.0
[2019-05-24 14:10:19 -0300] [16138] [INFO] Listening at: http://127.0.0.1:8000 (16138)
[2019-05-24 14:10:19 -0300] [16138] [INFO] Using worker: sync
[2019-05-24 14:10:19 -0300] [16141] [INFO] Booting worker with pid: 16141
[2019-05-24 14:10:22 -0300] [16141] [ERROR] Error handling request /ping
Traceback (most recent call last):
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "falcon/api.py", line 274, in falcon.api.API.__call__
  File "falcon/api.py", line 269, in falcon.api.API.__call__
  File "/home/viniarck/repos/hello_api/.direnv/python-3.5.5/lib/python3.5/site-package
s/falcon/hooks.py", line 179, in do_before
    action(req, resp, self, kwargs, *action_args, **action_kwargs)
TypeError: hook() takes 3 positional arguments but 4 were given

Code sample to reproduce:

import falcon
from falconratelimit import rate_limit


class PingResource(object):
    @falcon.before(rate_limit(per_second=5, window_size=30))
    def on_get(self, req, resp) -> None:
        resp.media = {"test": "hello"}


api = falcon.API()
api.add_route("/ping", PingResource())

Testing the endpoint

❯ http GET :8000/ping
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 141
Content-Type: text/html

<html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>

  </body>
</html>

This same example works fine with falcon 1.4.1.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.