import jsondecodeerror seperately since its not in ujson
This commit is contained in:
parent
919ab12b76
commit
39d0be32ac
6 changed files with 15 additions and 9 deletions
|
@ -17,6 +17,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from json import JSONDecodeError
|
||||
import ujson as json
|
||||
from flask import Blueprint, request, Response, abort
|
||||
|
||||
|
@ -42,7 +43,7 @@ def set_all_config():
|
|||
"""Overwrite existing JSON config with new JSON string"""
|
||||
try:
|
||||
new_config = request.get_json(force=True)
|
||||
except json.JSONDecodeError:
|
||||
except JSONDecodeError:
|
||||
abort(400)
|
||||
else:
|
||||
config.set_config(new_config)
|
||||
|
@ -59,7 +60,7 @@ def set_by_key(key):
|
|||
"""
|
||||
try:
|
||||
data = json.loads(bytes_to_str(request.data))
|
||||
except (json.JSONDecodeError, KeyError):
|
||||
except (JSONDecodeError, KeyError):
|
||||
abort(400)
|
||||
config.set(key, data, True)
|
||||
return Response('success')
|
Loading…
Add table
Add a link
Reference in a new issue