use ujson for serializing responses
This commit is contained in:
parent
0daf205cb0
commit
5b92706065
2 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
import itertools
|
||||
import json
|
||||
import ujson
|
||||
import typing
|
||||
import asyncio
|
||||
from asyncio import Event
|
||||
|
@ -186,7 +187,7 @@ class JSONRPC:
|
|||
def encode_payload(cls, payload):
|
||||
"""Encode a Python object as JSON and convert it to bytes."""
|
||||
try:
|
||||
return json.dumps(payload).encode()
|
||||
return ujson.dumps(payload).encode()
|
||||
except TypeError:
|
||||
msg = f'JSON payload encoding error: {payload}'
|
||||
raise ProtocolError(cls.INTERNAL_ERROR, msg) from None
|
||||
|
|
3
setup.py
3
setup.py
|
@ -42,7 +42,8 @@ setup(
|
|||
'hachoir==3.1.2',
|
||||
'filetype==1.0.9',
|
||||
'grpcio==1.38.0',
|
||||
'lbry-rocksdb==0.8.2'
|
||||
'lbry-rocksdb==0.8.2',
|
||||
'ujson==5.1.0'
|
||||
],
|
||||
extras_require={
|
||||
'lint': ['pylint==2.10.0'],
|
||||
|
|
Loading…
Reference in a new issue