Use orjson instead of json if available
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import binascii
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
from time import time
|
||||
|
||||
try:
|
||||
import orjson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
def _to_b64url(data):
|
||||
return (
|
||||
binascii.b2a_base64(data)
|
||||
|
||||
@@ -7,10 +7,14 @@ servers for MicroPython and standard Python.
|
||||
"""
|
||||
import asyncio
|
||||
import io
|
||||
import json
|
||||
import re
|
||||
import time
|
||||
|
||||
try:
|
||||
import orjson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
try:
|
||||
from inspect import iscoroutinefunction, iscoroutine
|
||||
from functools import partial
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import asyncio
|
||||
import json
|
||||
from microdot.helpers import wraps
|
||||
|
||||
try:
|
||||
import orjson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
|
||||
class SSE:
|
||||
"""Server-Sent Events object.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
from microdot.microdot import Request, Response, AsyncBytesIO
|
||||
|
||||
try:
|
||||
@@ -6,6 +5,11 @@ try:
|
||||
except: # pragma: no cover # noqa: E722
|
||||
WebSocket = None
|
||||
|
||||
try:
|
||||
import orjson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
__all__ = ['TestClient', 'TestResponse']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user