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, closed when the thread ends; client.close(), or with Client() as limiter:, closes every thread's.

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

Metadata

Release files for rateguard-client 0.5.1

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.1
File Size Uploaded Provenance Actions
rateguard_client-0.5.1.tar.gz 5.4 kB Without provenance Details for rateguard_client-0.5.1.tar.gz

Built distribution (wheel)

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

Total release size: 9.4 kB

Release files / rateguard_client-0.5.1.tar.gz

Download URL rateguard_client-0.5.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
65af17c5a91afd74de32069cd21993d4669c642d7adb0d2edcac0d9ed6cbd78f
BLAKE2b-256 checksum
How to use checksums
4999bd4d3d97ec361620e602c3b494d4f038e68851d5653b616e832b92906009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

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

Download URL rateguard_client-0.5.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3040cf9aad4cbb83bda426c97c46b06f8d0d9ac4f308d7dc23ff124d204eccb8
BLAKE2b-256 checksum
How to use checksums
8bf6a82a87b7916419e3e13b5f48ea2cc154735a4286ce857e549410463b3dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

Security for rateguard-client 0.5.1

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