tessl install tessl/pypi-pyrate-limiter@3.9.0Python Rate-Limiter using Leaky-Bucket Algorithm for controlling request rates in applications with multiple backend storage options.
Agent Success
Agent success rate when using this tile
81%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.45x
Baseline
Agent success rate without this tile
56%
Build an asynchronous rate-limited API client that enforces request limits and handles concurrent requests properly.
You need to implement an async API client that:
Your implementation should include:
fetch_user_data(user_id: int) -> dict that simulates fetching user datafetch_posts_data(post_id: int) -> dict that simulates fetching post dataprocess_batch(user_ids: list, post_ids: list) -> dict that fetches all data concurrently while respecting rate limitsThe batch processor should:
@generates
async def fetch_user_data(user_id: int) -> dict:
"""Fetch user data with rate limiting applied."""
pass
async def fetch_posts_data(post_id: int) -> dict:
"""Fetch post data with rate limiting applied."""
pass
async def process_batch(user_ids: list, post_ids: list) -> dict:
"""Process multiple requests concurrently with rate limiting.
Returns:
dict: {"users": [user_data...], "posts": [post_data...]}
"""
passProvides rate limiting support with async/await capabilities.