def read(self, n=None):
"""Read the file stream.
Args:
n (int, optional): The bytes to read from the stream, if n is None,
it means read the whole data stream.
Returns:
The data in bytes, if all data has been read, returns an empty string.
"""
if self.r is None:
self._init_r()
try:
if n is None:
return self.r.content
return self.r.raw.read(n)
except requests.RequestException:
raise_with_traceback(exceptions.HTTPError, 'Failed to read the response body')
评论列表
文章目录