From c620e3d0813a2285d318f3d8a6dce0d52827d0a5 Mon Sep 17 00:00:00 2001 From: Benjamin Rabier Date: Sun, 24 Jul 2016 16:19:48 +0200 Subject: [PATCH] Bug with Python 3: "TypeError: the JSON object must be str, not 'bytes'" --- yarn_api_client/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yarn_api_client/base.py b/yarn_api_client/base.py index c86a617..79a72fe 100644 --- a/yarn_api_client/base.py +++ b/yarn_api_client/base.py @@ -12,11 +12,13 @@ from urllib.parse import urlencode from .errors import APIError, ConfigurationError +import codecs class Response(object): def __init__(self, http_response): - self.data = json.load(http_response) + reader = codecs.getreader("utf-8") + self.data = json.load(reader(http_response)) class BaseYarnAPI(object):