kanicounter
kanicounter is a small Python library for counting events in rolling time windows. It raises an exception when an event exceeds the allowed count.
Usage
from kanicounter import EventCounter, EventLimitError
counter = EventCounter()
counter.add_watch_window(seconds=60, limit=10)
try:
counter.add_event()
except EventLimitError as exc:
print(exc)
limit is the number of events allowed inside the window. For example, seconds=60, limit=10 allows 10 events in the last 60 seconds and raises EventLimitError on the 11th event.
Installation
pip install kanicounter
Requirements
Python 3.8 or newer. There are no runtime dependencies.
Licence
MIT
Metadata
Release files for kanicounter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kanicounter-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for kanicounter-0.1.0.tar.gz |
Release files / kanicounter-0.1.0.tar.gz
| Download URL | kanicounter-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd8f8ac87de59ef09a87f356bd2b61eaa12fce470fb58bf8aea1f6d93978fb21
|
|
BLAKE2b-256 checksum How to use checksums |
a5854b4afb9ceae6d4fd573688a1f17dc24922633526e4287d8b1fac6dea9a50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for kanicounter 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.