All pastes #973487 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-06 03:48 UTC
rendered paste body
#!/usr/bin/python

import httplib, time
from urlparse import urlparse

loc = "http://noslor/ubuntu-7.04-desktop-i386.iso"
file = open('output', 'wb')

def main():
    global loc, file
    connection = httplib.HTTPConnection(urlparse(loc)[1])
    begin, size = 0, 10485700
    place = begin
    end = begin + size

    connection.request('GET', urlparse(loc)[2])
    response = connection.getresponse()

    start_t = time.time()

    while True:
        data = response.read(4096)
        place += len(data)