diff --git a/openaq_api/openaq_api/dependencies.py b/openaq_api/openaq_api/dependencies.py index 0cfc976..fe95a12 100644 --- a/openaq_api/openaq_api/dependencies.py +++ b/openaq_api/openaq_api/dependencies.py @@ -121,7 +121,9 @@ async def check_api_key( limited = True requests_used = int(value) ttl = await redis.ttl(key) - + request.state.rate_limiter = ( + f"{key}/{limit}/{requests_used}/{limit - requests_used}/{ttl}" + ) response.headers["x-ratelimit-limit"] = str(limit) response.headers["x-ratelimit-remaining"] = str(requests_used) response.headers["x-ratelimit-used"] = str(limit - requests_used) diff --git a/openaq_api/openaq_api/v3/routers/auth.py b/openaq_api/openaq_api/v3/routers/auth.py index 9e4e522..3abe3a0 100644 --- a/openaq_api/openaq_api/v3/routers/auth.py +++ b/openaq_api/openaq_api/v3/routers/auth.py @@ -243,7 +243,7 @@ async def get_register( if redis_client: async with redis_client.pipeline() as pipe: await pipe.sadd("keys", user_token).hset( - user_token, mapping={"rate": 2000} + user_token, mapping={"rate": 60} ).execute() return {"message": "success"} except Exception as e: