Metadata-Version: 2.1
Name: falcon-ratelimit
Version: 1.2
Summary: A rate limiter plugin for Falcon
Home-page: https://github.com/piotrmaslanka/falcon-ratelimit
Author: Piotr Maślanka
Author-email: piotr.maslanka@henrietta.com.pl
License: UNKNOWN
Description: falcon-ratelimit
        
        ================
        
        
        
        
        
        Rate limiter for Falcon. Install with:
        
        
        
        ```bash
        
        pip install falcon-ratelimit
        
        ```
        
        
        
        Use like:
        
        
        
        ```python
        
        import falcon
        
        from falconratelimit import rate_limit
        
        
        
        
        
        class NoRedisResource(object):
        
            @falcon.before(rate_limit(per_second=5, window_size=30,
        
            resource='resource_name'))
        
            def on_post(self, req, resp):
        
                ...
        
        
        
        class RedisResource(object):
        
           @falcon.before(rate_limit(redis_url='localhost:6379', per_second=1,
        
           window_size=10))
        
           def on_post(self, req, resp):
        
               ...
        
        ```
        
        
        
        This package works by limiting the number of requests using two variables
        
        `per_second` and `window_size`. In the first example above, the
        
        `NoRedisResource` class is restricted to 5 requests per second over a 30 second
        
        window meaning that there is a limit of 150 requests over 30 seconds. The
        
        default storage of calling the `rate_limit` decorator is an in memory list to
        
        store the number of requests for the given user using the resource
        
        `resource_name`.
        
        
        
        The second example implements the optional storage to use Redis by passing in a
        
        `redis_url` to store user request data. Using Redis allows for the rate
        
        limiting to be implemented across multiple instances of a particular
        
        application. In the `RedisResource` class example the user is allowed to make
        
        1 request per second over 10 seconds meaning that there is a limit of 10
        
        requests over 10 seconds. Since this example didn't pass in a `resource` it
        
        uses `default` as the name for request storage.
        
        
        
        If you do not have the `redis` package installed, Redis-related functionality
        
         will not work.
        
        
        
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Internet :: WWW/HTTP :: Session
Description-Content-Type: text/markdown; charset=UTF-8
