Skip to main content

rateguard-client (Python)

A client for rateguard-sidecar: one global rate limit across a fleet, from Python. Standard library only, Python 3.9 or newer.

pip install rateguard-client
from rateguard_client import Client

limiter = Client()  # http://127.0.0.1:7947, or $RATEGUARD_SIDECAR_URL

decision = limiter.check("tenant:42", cls="pro")
if not decision.allowed:
    return Response(status=429, headers={"Retry-After": str(math.ceil(decision.retry_after))})
Option Default Meaning
url $RATEGUARD_SIDECAR_URL or http://127.0.0.1:7947 The sidecar
timeout 0.05 Seconds to wait for an answer
on_error "allow" "allow" or "deny" the request when the sidecar cannot answer

A broken limiter should not take the service down with it, hence allow by default. One keep-alive connection per thread; client.close(), or with Client() as limiter:, closes the current thread's.

Tests: PYTHONPATH=src python3 -m unittest discover -s tests.

Metadata

Release files for rateguard-client 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rateguard-client 0.5.0
File Size Uploaded Provenance Actions
rateguard_client-0.5.0.tar.gz 5.0 kB Without provenance Details for rateguard_client-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rateguard-client 0.5.0
File Interpreter ABI Platform Actions
rateguard_client-0.5.0-py3-none-any.whl Python 3 none any Details for rateguard_client-0.5.0-py3-none-any.whl

Total release size: 8.8 kB

Release files / rateguard_client-0.5.0.tar.gz

Download URL rateguard_client-0.5.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6dfa05df054b1453c85f7971b701c3b02ae613bf74ed048cc5e2f91008b7c7f8
BLAKE2b-256 checksum
How to use checksums
2ff3ccd749b69c4502db1d11b13d55a669f16d33882d8371c40d231ca25f56a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / rateguard_client-0.5.0-py3-none-any.whl

Download URL rateguard_client-0.5.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a189406c4953fda98d64bb45165d041fd45292bb2d63fbf5a33e023d4765a0b0
BLAKE2b-256 checksum
How to use checksums
4904148590673a2a6113e2ed857c03df0d1dd62c12e874b494bee3b3cb4006cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Security for rateguard-client 0.5.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page