Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
import time
import tornado.ioloop
import tornado.httpclient
import logging
logging.basicConfig(level=logging.DEBUG)
io_loop = tornado.ioloop.IOLoop.instance()
interrupts_count = 0
def ugly_interrupt():
logging.debug('interrupt')
global interrupts_count
interrupts_count += 1
time.sleep(1)
io_loop.add_callback(ugly_interrupt)
io_loop.add_callback(ugly_interrupt)
http_client = tornado.httpclient.AsyncHTTPClient()
start_time = time.time()
def fetch_finished(response):
logging.debug('interrupts: %s', interrupts_count)
logging.debug('time taken: %s', time.time() - start_time)
if not response.error:
logging.debug('file size: %s', len(response.body))
io_loop.stop()
# ~1Mb file
http_client.fetch("http://de.archive.ubuntu.com/ubuntu/pool/main/v/vim/vim_7.2.330-1ubuntu3_i386.deb", callback=fetch_finished)
io_loop.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.