Switched to try/except
This commit is contained in:
parent
53b61d13f9
commit
5f140048f4
|
@ -10,8 +10,10 @@ except ImportError:
|
||||||
from json import loads as _json_loads
|
from json import loads as _json_loads
|
||||||
|
|
||||||
def json_loads(i):
|
def json_loads(i):
|
||||||
i = i.decode() if isinstance(i, bytes) else i
|
try:
|
||||||
return _json_loads(i)
|
return _json_loads(i.decode())
|
||||||
|
except AttributeError:
|
||||||
|
return _json_loads(i)
|
||||||
|
|
||||||
from sanic.exceptions import InvalidUsage
|
from sanic.exceptions import InvalidUsage
|
||||||
from sanic.log import log
|
from sanic.log import log
|
||||||
|
|
Loading…
Reference in New Issue
Block a user