Metadata-Version: 2.1
Name: floodgate-rs
Version: 0.1.2
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
License-File: LICENSE
Summary: Python bindings for, a ratelimiting library written in Rust.
Keywords: cooldown,ratelimit,rate limit,rust,pyo3
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# Floodgate-rs

Python bindings for [floodgate](https://github.com/CircuitSacul/floodgate/), a ratelimiting library written in rust.

## Example

```python
from datetime import timedelta
from floodgate import FixedMapping

cooldown = FixedMapping(capacity=5, period=timedelta(seconds=20))

def handle_event(sender):
    retry_after = cooldown.trigger(sender)
    if retry_after is None:
        print("Event succeeded!")
    else:
        print(f"Too many events from {sender}. Retry in {retry_after} seconds.")
```

