mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
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:
1 parent
67ad5980b2
commit
52e46bedda
6 files changed
+184
-183
No files matched your search
@@ -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"""
|
||||
|
||||
Reference in new issue
Block a user