1
0
mirror of https://github.com/httpie/cli.git synced 2025-02-01 12:57:57 +02:00

Made --verbose work also with requests<0.12.1.

This commit is contained in:
Jakub Roztocil 2012-06-13 15:25:05 +02:00
parent 6cf2910de0
commit d544ec3823
2 changed files with 9 additions and 1 deletions

View File

@ -18,6 +18,13 @@ def from_request(request):
request_headers = dict(request.headers)
if 'Host' not in request_headers:
request_headers['Host'] = url.netloc
try:
body = request.data
except AttributeError:
# requests < 0.12.1
body = request._enc_data
return HTTPMessage(
line='{method} {path} HTTP/1.1'.format(
method=request.method,
@ -25,7 +32,7 @@ def from_request(request):
headers='\n'.join(str('%s: %s') % (name, value)
for name, value
in request_headers.items()),
body=request.data,
body=body,
content_type=request_headers.get('Content-Type')
)

View File

@ -9,6 +9,7 @@ if sys.argv[-1] == 'test':
sys.exit()
# Debian has only requests==0.10.1 and httpie.deb depends on that.
requirements = ['requests>=0.10.1', 'Pygments>=1.5']
if sys.version_info[:2] in ((2, 6), (3, 1)):
# argparse has been added in Python 3.2 / 2.7