Take advantage of streaming.

It's now possible to download huge files with HTTPie, and it's often faster than curl and wget!
This commit is contained in:
Jakub Roztocil committed 2012-08-01 23:21:52 +02:00
1 parent 67ad5980b2
commit 52e46bedda
6 files changed
+184 -183

No files matched your search

+7
View File
@@ -57,6 +57,10 @@ class HTTPMessage(object):
class HTTPResponse(HTTPMessage):
"""A `requests.models.Response` wrapper."""
def __iter__(self):
mb = 1024 * 1000
return self._orig.iter_content(chunk_size=2 * mb)
@property
def line(self):
"""Return Status-Line"""
@@ -85,6 +89,9 @@ class HTTPResponse(HTTPMessage):
class HTTPRequest(HTTPMessage):
"""A `requests.models.Request` wrapper."""
def __iter__(self):
yield self.body
@property
def line(self):
"""Return Request-Line"""