Switched to try/except

This commit is contained in:
Jakob Bowyer 2017-03-02 15:16:01 +00:00
parent 53b61d13f9
commit 5f140048f4

View File

@ -10,7 +10,9 @@ except ImportError:
from json import loads as _json_loads
def json_loads(i):
i = i.decode() if isinstance(i, bytes) else i
try:
return _json_loads(i.decode())
except AttributeError:
return _json_loads(i)
from sanic.exceptions import InvalidUsage