To add to the response by namizaru: you can only control some parts of the key with this library.
Given the example from namizaru:
LIMITER/127.0.0.1/slow/1/1/day
The string "LIMITER" comes from the limits library (https://github.com/alisaifee/limits), which Flask-limiter wraps. I don’t see a good way to override this.
"127.0.0.1" is the result of the key_func parameter passed to Limiter (get_remote_address) and should return a unique string that identifies the rate-limited resource, as far as I understand. So, you can provide your own callable there, but that only changes one portion of the key.
Meanwhile, the delimiter ("/") also comes from the limits library and does not seem overridable.
2
Answers
You can set a key prefix
This changes the keyname from
to
To add to the response by namizaru: you can only control some parts of the key with this library.
Given the example from namizaru:
The string "LIMITER" comes from the limits library (https://github.com/alisaifee/limits), which Flask-limiter wraps. I don’t see a good way to override this.
"127.0.0.1" is the result of the
key_func
parameter passed toLimiter
(get_remote_address
) and should return a unique string that identifies the rate-limited resource, as far as I understand. So, you can provide your own callable there, but that only changes one portion of the key.Meanwhile, the delimiter ("/") also comes from the limits library and does not seem overridable.