#!/usr/bin/python
import httplib, time
from urlparse import urlparse
loc = "http://noslor/ubuntu-7.04-desktop-i386.iso"
file = open('output', 'w')
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()
while True:
data = response.read(4096)
if data == '':
break
file.write(data)
if place > end:
break
connection.close()
if __name__ == '__main__':
start_t = time.time()
main()
end_t = time.time()
print end_t - start_t