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
Latihan ini adalah bagian dari kursus
Deploying AI into Production with FastAPI
Latihan interaktif praktis
Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.
Mulai berolahraga