code: def main():
      
      # Prepare.
      if os.name == 'nt':
          locale.setlocale(locale.LC_ALL, 'english-us')
      else:
          locale.resetlocale()
      response = requests.get(OPTIONS['<url>'], stream=True)
      content_length = None if OPTIONS['--ignore-length'] else int(response.headers.get('Content-Length'))
      progress_bar = ProgressBarWget(content_length, eta_every=4)
      thread = DownloadThread(response)
      print_every_seconds = 0.25
  
      # Download.
      thread.start()
      while True:
          progress_bar.numerator = thread.bytes_downloaded
          print(progress_bar, end='\r')
          sys.stdout.flush()
  
          # For undefined downloads (no content-length), check if thread has stopped. Loop only checks defined downloads.
          if not thread.isAlive():
              progress_bar.force_done = True
              break
          if progress_bar.done:
              break
  
          time.sleep(print_every_seconds)
      print(progress_bar)
docs: From: http://stackoverflow.com/questions/20801034/how-to-measure-download-speed-and-progress-using-requests