Skip to main content

Consume any API with no ratelimit breach, patient mode 💤

Project description

AsyncApiThrottler README

AsyncApiThrottler is a Python library designed for managing API request rate limits in asynchronous applications. It allows you to easily configure global and endpoint-specific rate limits, ensuring your application adheres to the API's rate limiting policies and prevents being blocked or rate-limited. This README provides a quick start example on how to use AsyncApiThrottler with httpx for making asynchronous API requests.

Quick Start Example

import httpx
from async_api_throttler import AsyncApiThrottler

# Initialize the throttler with a global rate limit
api_throttler = AsyncApiThrottler(max_calls=100, period=1)

# Apply endpoint-specific rate limits using the decorator
@api_throttler.limits(10, 1)
async def request_user_endpoint():
    # Make an asynchronous API request using httpx
    async with httpx.AsyncClient() as client:
        response = await client.get('https://api.example.com/user')
        return response.json()

This example demonstrates how to set up AsyncApiThrottler with a global limit of 100 requests per minute and a specific rate limit of 10 requests per minute for the '/user' endpoint. By integrating AsyncApiThrottler in this way, you ensure your application respects the API's rate limits, promoting efficient and responsible usage of resources.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_api_throttler-0.2.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

async_api_throttler-0.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file async_api_throttler-0.2.0.tar.gz.

File metadata

  • Download URL: async_api_throttler-0.2.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.9

File hashes

Hashes for async_api_throttler-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3048a3771d77bed51567dae02a0edba9de9396c04a54850143a86162cbfa98cf
MD5 a8ebbc3f0f85394b2a1bfd1692d2a6b8
BLAKE2b-256 e521517c8fd33ce900cabe182e665b0cc8cb27b5dae66f2a65edcccd7e2ce500

See more details on using hashes here.

File details

Details for the file async_api_throttler-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for async_api_throttler-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4154a1f303d5747c5c220614e609d4b7dee45fce154da1795ee69d3ad200d8e7
MD5 4ad7f09a9cd9697b4e858106dce4818d
BLAKE2b-256 77a34dc42821c021914485efc1581996f4e27940879a32840aa7bee8251b6b22

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page