From aed09881ee3a21c284a3c8039cbc883c6b466013 Mon Sep 17 00:00:00 2001 From: Alec Buckenheimer Date: Thu, 16 Feb 2017 14:51:05 -0500 Subject: [PATCH] #449 use stdlib json module if ujson is unavailible --- sanic/request.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sanic/request.py b/sanic/request.py index 086d749d..85f926a2 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -3,11 +3,13 @@ from collections import namedtuple from http.cookies import SimpleCookie from httptools import parse_url from urllib.parse import parse_qs - -from ujson import loads as json_loads - from sanic.exceptions import InvalidUsage -from sanic.log import log +try: + from ujson import loads as json_loads +except ImportError: + from json import loads as json_loads + +from .log import log DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"