Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/windfarer/redis-token-bucket

An python token bucket implementation on redis
https://github.com/windfarer/redis-token-bucket

Last synced: 18 days ago
JSON representation

An python token bucket implementation on redis

Awesome Lists containing this project

README

        

# redis-token-bucket

## Usage:
```python
from redis_token_bucket import TokenBucketManager

tbm = TokenBucketManager(redis_url="redis://path-to-your-redis", default_rate=10)
# default_rate means how many tokens will be generated per second.

ok = tbm.get_token("my_key")
# if token avaliable, return True, else return False

```

## TODO
* burst rate