Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Something
Saturday, April 5th, 2008 at 11:49:08pm MDT 

  1. #!/usr/bin/python
  2.  
  3. import httplib, time
  4. from urlparse import urlparse
  5.  
  6. loc = "http://localhost/ubuntu-7.04-desktop-i386.iso"
  7. file = open('output', 'wb')
  8.  
  9. def main():
  10.     global loc, file
  11.     connection = httplib.HTTPConnection(urlparse(loc)[1])
  12.     begin, size = 0, 10485700
  13.     place = begin
  14.     end = begin + size
  15.  
  16.     connection.request('GET', urlparse(loc)[2])
  17.     response = connection.getresponse()
  18.  
  19.     start_t = time.time()
  20.  
  21.     while True:
  22.         response.read(10485700)
  23.         break
  24.         place += len(data)
  25.         if data == '':
  26.             break
  27.         #file.write(data)
  28.         if place > end:
  29.             break
  30.  
  31.     end_t = time.time()
  32.  
  33.     connection.close()
  34.     file.close()
  35.  
  36.     return end_t - start_t
  37.  
  38. if __name__ == '__main__':
  39.     print main()

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

fantasy-obligation