diff --git a/examples/19_rate_limit.py b/examples/19_rate_limit.py index 885c984..7e4a5fe 100644 --- a/examples/19_rate_limit.py +++ b/examples/19_rate_limit.py @@ -1,7 +1,7 @@ from sqlalchemy import create_engine from sqlalchemy.pool import StaticPool -from lightapi import EndpointRateLimitMiddleware, HttpMethod, LightAPI, RestEndpoint +from lightapi import EndpointRateLimitMiddleware, HttpMethod, LightApi, RestEndpoint from lightapi.fields import Field @@ -10,7 +10,7 @@ class BookEndpoint(RestEndpoint, HttpMethod.GET): author: str = Field(min_length=1) class Meta: - rate_limit = {"request": 3, "window": 60} + rate_limit = {"requests": 3, "window": 60} if __name__ == "__main__": @@ -19,6 +19,6 @@ class Meta: connect_args={"check_same_thread": False}, poolclass=StaticPool, ) - app = LightAPI(engine=engine, middlewares=[EndpointRateLimitMiddleware]) + app = LightApi(engine=engine, middlewares=[EndpointRateLimitMiddleware]) app.register({"/books": BookEndpoint}) - app.run(host="0.0.0.0", port=8000, reload=True) + app.run(host="0.0.0.0", port=8000, debug=True)