Metadata-Version: 2.1
Name: Function-Limiter
Version: 0.0.10
Summary: Rate limiting for callable functions
Home-page: https://github.com/mghorbani2357/Function-Limiter
Author: Mohsen Ghorbani
Author-email: m.ghorbani2357@gmail.com
License: MIT
Description: .. |license| image:: https://img.shields.io/pypi/l/Function-Limiter.svg?style=flat
            :target: https://pypi.python.org/pypi/Function-Limiter
            
        .. |build| image:: https://travis-ci.com/mghorbani2357/Function-Limiter.svg?branch=master
            :target: https://travis-ci.com/mghorbani2357/Function-Limiter
            
        .. |codecov| image:: https://codecov.io/gh/mghorbani2357/Function-Limiter/branch/master/graph/badge.svg?token=V606VBKSGK
            :target: https://codecov.io/gh/mghorbani2357/Function-Limiter
        
        ..  |quality| image:: https://api.codacy.com/project/badge/Grade/4ec8eeac03144927aef804e2388b7988
            :target: https://app.codacy.com/gh/mghorbani2357/Function-Limiter?utm_source=github.com&utm_medium=referral&utm_content=mghorbani2357/Function-Limiter&utm_campaign=Badge_Grade
           
        .. |coverage| image:: https://app.codacy.com/project/badge/Coverage/ebc9c5345a4f48bda082b09b815cee57   
            :target: https://www.codacy.com/gh/mghorbani2357/Function-Limiter/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mghorbani2357/Function-Limiter&utm_campaign=Badge_Coverage
        
        .. |downloadrate| image:: https://img.shields.io/pypi/dm/Function-Limiter
            :target: https://pypistats.org/packages/function-lim<iter
        
        
        *****************
        Function-Limiter
        *****************
        
        .. class:: center
        
            |license| |build| |quality| |coverage| |downloadrate|
        
        
        Function-Limiter provides rate limiting features to callable function.
        
        Installation
        ============
        
        .. code-block:: bash
        
            pip install Function-Limiter
        
        
        Quick Start
        ===========
        
        Add the rate limiter to your function as decorator. The following example uses the default
        in memory implementation for storage.
        
        The decorators made available as instance methods of the Limiter instance are ``Limiter``.
        
        .. code-block:: python
        
            from function_limiter.limiter import Limiter
            from function_limiter.limiter import RateLimitExceeded
            import time
        
            limiter = Limiter()
        
        
            @limiter.limit('3/second', 'key')
            def function():
                print('hello world!')
        
        
        .. code-block:: python
        
            from function_limiter.limiter import Limiter
            from function_limiter.limiter import RateLimitExceeded
            import time
        
            storage_uri = 'redis://ip:port/'
            limiter = Limiter(
                    storage_uri=storage_uri
                )
        
        
        There are a few ways of using this decorator depending on your preference and use-case.
        
        
        Single decorator
        ================
        
        The limit string can be a single limit or a delimiter separated string
        
        .. code-block:: python
        
            @limiter.limit('3/second;10 per minute', 'key')
            def function():
                print('hello world!')
        
        Multiple decorators
        ===================
        
        The limit string can be a single limit or a delimiter separated string or a combination of both.
        
        .. code-block:: python
        
            @limiter.limit('3/second', 'key')
            @limiter.limit('10 per minute', 'key')
            def function():
                print('hello world!')
        
        
        Custom keying function
        ======================
        
        By default rate limits are applied based on the key function that the Limiter instance was initialized with. You can implement your own function to retrieve the key to rate limit by when decorating individual routes. Take a look at Rate Limit Key Functions for some examples.
        
        .. code-block:: python
        
            def limitation():
                return '5/second'
        
            def key():
                return 'custom key'
        
            @limiter.limit(limitation, key=key)
            def function():
                print('hello world!')
        
        .. :changelog:
        
        Changelog
        =========
        
        v0.0.10
        -------
        Release Date: 2021-02-14
            * Global limitations added.
        
        v0.0.9
        ------
        Release Date: 2021-01-28
            * Rate limit policy changed to successful call.
            * Bug Fixed:
                * Multiple limit doesn't work.
        
        v0.0.8
        ------
        Release Date: 2021-01-17
            * Bug Fixed:
                * Null key bugs Fixed.
        
        v0.0.7
        ------
        Release Date: 2021-01-17
            * Bug Fixed.
        
        v0.0.6
        ------
        Release Date: 2021-01-16
            * Added redis as in memory storage.
        
        v0.0.5
        ------
        Release Date: 2021-01-16
            * Added garbage collector.
        
        v0.0.4
        ------
        Release Date: 2021-01-16
            * Added Validator to limiter.
        
        v0.0.3
        ------
        Release Date: 2021-01-14
            * Added callable function for limitation and key function.
        
        v0.0.2
        ------
        Release Date: 2021-01-14
            * Bug fixed.
        
        v0.0.1
        ------
        Release Date: 2021-01-13
            * Basic Function Limiter.
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: Implementation :: PyPy
Description-Content-Type: text/x-rst
