Aan de slagGa gratis aan de slag

Add rate limiting to endpoint

The next step in securing the API endpoint is to add rate limit logic to the previously defined test_api_key function that checks both the API key validity and enforces rate limiting. You need to integrate the rate limiting logic that you defined in the RateLimiter class and raise HTTP exceptions in case the limit is exceeded.

You will be updating the test_api_key function from main.py script here.

All the supporting code for model creation and loading is in model.py

Deze oefening maakt deel uit van de cursus

Deploying AI into Production with FastAPI

Cursus bekijken

Praktische interactieve oefening

Zet theorie om in actie met een van onze interactieve oefeningen.

Begin met trainen