urlopen_progress(url,
output_stream=None,
fields='OoRrtcl',
chunk_size=4096)
| source code
|
Progress reporter for urlopen(). This is a generator which, upon
receipt of each chunk of data, yields a tuple of values. This tuple
reports data about the progress of the download; the exact values yielded
can be configured.
Based on http://mail.python.org/pipermail/python-list/2006-January/320635.html.
- Parameters:
url (str) - The URL to fetch.
output_stream (stream) - The file-like stream object to write to.
fields (str) - A set of characters indicating what data to report. The following
characters have meaning:
-
O: offset where the first byte of the latest chunk is to be
written
-
o: offset percentage
-
R: received number of bytes (offset + length of latest chunk)
-
r: received percentage
-
t: total number of bytes
-
c: the latest chunk
-
l: the length of the latest chunk
chunk_size (int) - The requested chunk size.
|