flask.request.json => flask.request.get_json()

Old property is deprecated as of Flask 0.11
This commit is contained in:
Gina Häußge committed 2017-02-21 13:18:59 +01:00
1 parent b7a0f5bee5
commit dbe4acd47d
11 files changed
+63 -25

No files matched your search

+4 -1
View File
@@ -326,10 +326,13 @@ def printerCommand():
return make_response("Expected content type JSON", 400)
try:
data = request.json
data = request.get_json()
except BadRequest:
return make_response("Malformed JSON body in request", 400)
if data is None:
return make_response("Malformed JSON body in request", 400)
if "command" in data and "commands" in data:
return make_response("'command' and 'commands' are mutually exclusive", 400)
elif ("command" in data or "commands" in data) and "script" in data: