You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: implement rate limiting to prevent abuse
This commit introduces rate limiting to the linebot to prevent abuse and ensure fair usage.
- Added a new `redis_client.py` to manage the Redis connection.
- Added a `RateLimiter` class in `rate_limiter.py` to handle rate limiting logic using Redis.
- Modified `text_handler.py` to integrate the `RateLimiter`.
- Implemented a check to determine if a user has exceeded their request limit.
- If the limit is exceeded, a message is sent to the user informing them of the rate limit and the time remaining until they can make another request.
- Added `flex_message.py` to convert flex message to json.
- Added `__init__.py` to export the utils.
- Added `redis` to `pyproject.toml`.
- Added `*.rdb` to `.gitignore`.
* feat(linebot): add redis support for rate limiting
This commit introduces Redis integration for rate limiting in the Line
Bot application. It includes the following changes:
- Added Redis configuration parameters (REDIS_HOST, REDIS_PORT,
REDIS_DB) to the .env.example file.
- Updated the README.md file to include instructions for installing
sqlite3 and redis.
- Modified the redis_client.py file to read Redis configuration from
environment variables, allowing for flexible deployment.
The addition of Redis enables the implementation of robust rate
limiting mechanisms, preventing abuse and ensuring the stability of
the Line Bot service.
0 commit comments