我不断Error: Nonetype
从 Sanic 应用程序中获取信息,但我无法确定原因。
我的代码:
from sanic import Sanic
from sanic.response import json, text
from sanic.request import RequestParameters
from parse_data import ParseData
pdata = ParseData()
app = Sanic('sanic_sms')
app = Sanic(__name__)
@app.route("/", methods=["POST",])
async def test(request):
data = {}
if request.form:
data = request.form
elif request.json:
data = request.json
result = pdata.prepare_output(data.get('text'))
resp = json(result)
resp.headers["Access-Control-Allow-Origin"] = "*"
resp.headers["Access-Control-Allow-Headers"] = "Content-Type,Authorization"
return resp
app.run(host="0.0.0.0", port=8002)
2017-05-13 15:10:03,454:信息:快点 @ http://0.0.0.0:8002
2017-05-13 15:10:03,456:信息:启动工人 [30662] 2017-05-13
15 :11:19,579:错误:无类型
我该如何解决这个问题?