Skip to content

Commit 0e4ee45

Browse files
committed
Merge pull request disqus#36 from thiblahute/py3-fixes
Py3 fixes
2 parents 20d363f + 7e80fac commit 0e4ee45

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

phabricator/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,13 @@ def validate_kwarg(key, target):
301301
'Bad response status: {0}'.format(response.status)
302302
)
303303

304-
data = self._parse_response(response.read())
304+
response_data = response.read()
305+
if isinstance(response_data, str):
306+
response = response_data
307+
else:
308+
response = response_data.decode("utf-8")
309+
310+
data = self._parse_response(response)
305311

306312
return Result(data['result'])
307313

@@ -327,7 +333,7 @@ def __init__(self, username=None, certificate=None, host=None,
327333
defined_hosts = ARCRC.get('hosts', {})
328334

329335
try:
330-
self.host = host if host else defined_hosts.keys()[0]
336+
self.host = host if host else list(defined_hosts.keys())[0]
331337
except IndexError:
332338
raise ConfigurationError("No host found or provided.")
333339

0 commit comments

Comments
 (0)