Repository: cloudstack-cloudmonkey Updated Branches: refs/heads/master 088001e7a -> f0a7c275e
requester: fix unicode param encoding bug Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/a92025f0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/a92025f0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/a92025f0 Branch: refs/heads/master Commit: a92025f0b969dd28a91d8063f8ffbd327353a130 Parents: 088001e Author: Rohit Yadav <rohit.ya...@shapeblue.com> Authored: Fri Oct 31 18:03:24 2014 +0530 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Fri Oct 31 18:03:24 2014 +0530 ---------------------------------------------------------------------- cloudmonkey/requester.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/a92025f0/cloudmonkey/requester.py ---------------------------------------------------------------------- diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py index eaf9de9..e05dc75 100644 --- a/cloudmonkey/requester.py +++ b/cloudmonkey/requester.py @@ -76,7 +76,7 @@ def login(url, username, password): sessionkey = None elif resp.status_code == 531: writeError("Error authenticating at %s using username: %s" - ", and password: %s\n" % (url, username, password)) + ", and password: %s" % (url, username, password)) session = None sessionkey = None else: @@ -173,7 +173,7 @@ def make_request(command, args, logger, url, credentials, expires): args['apiKey'] = credentials['apikey'] secretkey = credentials['secretkey'] - request = zip(args.keys(), args.values()) + request = zip(args.keys(), map(lambda x: x.encode("utf-8"), args.values())) request.sort(key=lambda x: x[0].lower()) request_url = u"&".join([u"=".join([r[0], urllib.quote(r[1])]) @@ -191,7 +191,8 @@ def make_request(command, args, logger, url, credentials, expires): connection = urllib2.urlopen(request_url) response = connection.read() except HTTPError, e: - error = u"{0}: {1}".format(e.msg, e.info().getheader('X-Description')) + error = u"{0}{1}: {2}".format(e.code, e.msg, + e.info().getheader('X-Description')) except URLError, e: error = e.reason