Metadata-Version: 2.1
Name: async_api_throttler
Version: 0.1.2
Summary: Consume any API with no ratelimit breach, patient mode 💤
Home-page: https://github.com/devamin/async-api-throttler/
Author: Amine Benkhouya
Author-email: amine.benkhouya@example.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown


# 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

```python
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.
