Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(3)  |  Derive(0)  |  Import(2)

src/f/l/Flask-Limiter-0.3.1/tests/test_strategy.py   Flask-Limiter(Download)
from flask.ext.limiter.storage import MemoryStorage, RedisStorage, \
    MemcachedStorage
from flask.ext.limiter.strategies import MovingWindowRateLimiter, \
    FixedWindowElasticExpiryRateLimiter, FixedWindowRateLimiter
 
    def test_moving_window_in_memory(self):
        storage = MemoryStorage()
        limiter = MovingWindowRateLimiter(storage)
        with hiro.Timeline().freeze() as timeline:
            limit = PER_MINUTE(10)
    def test_moving_window_redis(self):
        storage = RedisStorage("redis://localhost:6379")
        limiter = MovingWindowRateLimiter(storage)
        limit = PER_SECOND(10, 2)
        start = time.time()

src/f/l/Flask-Limiter-0.3.1/tests/test_storage.py   Flask-Limiter(Download)
import hiro
import redis
from flask.ext.limiter.strategies import FixedWindowRateLimiter, \
    MovingWindowRateLimiter
 
    def test_large_dataset_redis_moving_window_expiry(self):
        storage = RedisStorage("redis://localhost:6379")
        limiter = MovingWindowRateLimiter(storage)
        limit = PER_SECOND(1000)
        # 100 routes