执行:

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

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>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.</p>


·「报错如上」

·「代码报错如下」:


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 应该小写


GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
960b763e 3 个月前
8c391e04 6 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐