执行:
raini@biyuzhe:~/pyspark_project/mysql1/anqu/python/anquProduct/Server/insertDataHql$
curl -i -H "Content-Type: application/json" -X POST -d '{"appIds": [{"appid": "1076877374"}, {"appid": "1108288808"}], "language": "cn", "EmailAddress": "", "ClusterNum": 2, "WordNum": 2, "EmailMessage": True, "ShowOnWebPage": True}' http://localhost:5000/ana The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
HTTP/1.0 500 INTERNAL SERVER ERRORContent-Type: text/html
Content-Length: 291
Server: Werkzeug/0.12.1 Python/2.7.12
Date: Thu, 11 May 2017 03:38:52 GMT
Internal Server Error
·「报错如上」
·「代码报错如下」:
File "/home/raini/pyspark_project/./mysql1/anqu/python/anquProduct/restApi/flask/RestApiServer.py", line 144, in call_analysis
return jsonify({'task': runAnalysis(data)}), 201
File "/home/raini/pyspark_project/./mysql1/anqu/python/anquProduct/restApi/flask/RestApiServer.py", line 97, in runAnalysis
ta = json.loads(pare)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
127.0.0.1 - - [11/May/2017 11:38:52] "POST /ana HTTP/1.1" 500 -
原因:
"EmailMessage": True, "ShowOnWebPage": True} --> python true 应该小写