From 79c412064ac6fc8afd8f01e246bc703eae14e924 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Thu, 3 Jan 2013 14:54:34 +0100 Subject: [PATCH] Python 3.3 fixes. --- httpie/manage.py | 4 +--- httpie/models.py | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/httpie/manage.py b/httpie/manage.py index 7c94c90a..c0fa871b 100644 --- a/httpie/manage.py +++ b/httpie/manage.py @@ -8,7 +8,6 @@ import inspect import argparse import functools -from . import __version__ from .input import RegexValidator from .sessions import (Session, Host, command_session_list, @@ -18,8 +17,7 @@ from .sessions import (Session, Host, parser = argparse.ArgumentParser( - description='The HTTPie management command.', - version=__version__ + description='The HTTPie management command.' ) subparsers = parser.add_subparsers() diff --git a/httpie/models.py b/httpie/models.py index 94df1fb2..40ad7302 100644 --- a/httpie/models.py +++ b/httpie/models.py @@ -168,4 +168,8 @@ class HTTPRequest(HTTPMessage): @property def body(self): - return self._orig.body or b'' + body = self._orig.body + if isinstance(body, str): + # Happens with JSON/form request data parsed from the command line. + body = body.encode('utf8') + return body or b''