mirror of
https://github.com/httpie/cli.git
synced 2025-06-26 20:41:49 +02:00
parent
2c885b0981
commit
b01906a45c
@ -417,11 +417,20 @@ class ProgressReporterThread(threading.Thread):
|
|||||||
time_taken = self.status.time_finished - self.status.time_started
|
time_taken = self.status.time_finished - self.status.time_started
|
||||||
|
|
||||||
self.output.write(CLEAR_LINE)
|
self.output.write(CLEAR_LINE)
|
||||||
|
|
||||||
|
try:
|
||||||
|
speed = actually_downloaded / time_taken
|
||||||
|
except ZeroDivisionError:
|
||||||
|
# Either time is 0 (not all systems provide `time.time`
|
||||||
|
# with a better precision than 1 second), and/or nothing
|
||||||
|
# has been downloaded.
|
||||||
|
speed = actually_downloaded
|
||||||
|
|
||||||
self.output.write(SUMMARY.format(
|
self.output.write(SUMMARY.format(
|
||||||
downloaded=humanize_bytes(actually_downloaded),
|
downloaded=humanize_bytes(actually_downloaded),
|
||||||
total=(self.status.total_size
|
total=(self.status.total_size
|
||||||
and humanize_bytes(self.status.total_size)),
|
and humanize_bytes(self.status.total_size)),
|
||||||
speed=humanize_bytes(actually_downloaded / time_taken),
|
speed=humanize_bytes(speed),
|
||||||
time=time_taken,
|
time=time_taken,
|
||||||
))
|
))
|
||||||
self.output.flush()
|
self.output.flush()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user