Implementation of a Rate limiter in Python (https://codingchallenges.fyi/challenges/challenge-rate-limiter)
- Docker
- Docker-compose
Clone the repository: git clone https://github.com/niyazi-eren/rate-limiter
cd rate-limiter
docker-compose run --build --rm -p 8000:8000 python --strategy sliding_db
docker-compose run --build --rm -p port_number:port_number python --port <port_number> --rate <rate> --strategy <strategy>
For a server running on port 8000 for example:
- You can try
curl localhost:8000/limited
- Or
curl localhost:8000/unlimited
docker-compose run --build --rm -p 8080:8080 python --port 8080 --rate 20 --strategy log
docker-compose run --build --rm -p 8000:8000 python
There is a bash script to run tests for the sliding window counter algorithm: you need to launch 2 servers with the correct algorithm, one in port 8000 one in 8001
A better way is to use Postman