def download_progress_hook(count, blockSize, totalSize):
 global last_percent_reported
 percent = int((((count * blockSize) * 100) / totalSize))
 if (last_percent_reported != percent):
  if ((percent % 5) == 0):
   sys.stdout.write(('%s%%' % percent))
   sys.stdout.flush()
  else:
   sys.stdout.write('.')
   sys.stdout.flush()
  last_percent_reported = percent

def download_progress_hook ( count , blockSize , totalSize ) : global last_percent_reported percent = int ( ( ( ( count * blockSize ) * 100 ) / totalSize ) ) if ( last_percent_reported != percent ) : if ( ( percent % 5 ) == 0 ) : sys . stdout . write ( ( '%s%%' % percent ) ) sys . stdout . flush ( ) else : sys . stdout . write ( '.' ) sys . stdout . flush ( ) last_percent_reported = percent
a hook to report the progress of a download .