Skip to content

Commit

Permalink
Made --verbose work also with requests<0.12.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbrzt committed Jun 13, 2012
1 parent 6cf2910 commit d544ec3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion httpie/httpmessage.py
Expand Up @@ -18,14 +18,21 @@ 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,
path=url.path or '/'),
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')
)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -9,6 +9,7 @@
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
Expand Down

0 comments on commit d544ec3

Please sign in to comment.