def main(): # setup the rate limit to 200 KB/s aiothrottle.limit_rate(200 * 1024) # download a large file without blocking bandwidth loop = asyncio.get_event_loop() loop.run_until_complete(load_file( "http://ipv4.download.thinkbroadband.com/10MB.zip", loop)) # unset the rate limit aiothrottle.unlimit_rate()
def test_global_unlimit_rate(self): aiothrottle.limit_rate(10) aiothrottle.unlimit_rate() klass = ClientResponse.flow_control_class self.assertIs(klass, aiohttp.streams.FlowControlStreamReader)