def acquire_limit(self, key, expiration_in_seconds=None, retry=True):

        limit_available = self.redis.zcard(self.prefix) < self.limit

        if limit_available:
            self.__lock_limit(key, expiration_in_seconds)
            return True

        if retry:
            self.redis.zremrangebyscore(self.prefix, '-inf', time.time())
            return self.acquire_limit(key, expiration_in_seconds, retry=False)

        return False
Tries to acquire a limit for a given key. Returns True if the limit can be acquired.
dataset/ETHPy150Open bbangert/retools/retools/limiter.py/Limiter.acquire_limit