我调用BlueData MLOPS预测API来获得我的模型的分数,但是我得到了以下响应:
============================response begin==========================================
Status code : {}200
Status text : {}OK
Headers : {}{Server=[gunicorn/19.9.0], Date=[Sat, 23 Nov 2019 12:16:43 GMT], Content-Type=[text/html; charset=utf-8], Content-Length=[50]}
Response body: {}'NoneType' object does not support item assignment
=======================response end=================================================是什么导致了这一切?
发布于 2019-11-23 12:20:12
在仔细检查我的请求时,我注意到我将内容类型设置为text/plain
===========================request begin================================================
URI : {}http://xxxx:10026/diabetes%20model/1/predict
Method : {}POST
Headers : {}{Accept=[application/json], X-Auth-Token=[6EMbYcQsBD], Content-Type=[text/plain;charset=ISO-8859-1], Content-Length=[174], Accept-Charset=[big5, ...]}
Request body: {}{"use_scoring": true, "scoring_args": {"NumPreg":1.0,"Glucose": 85.0,"BloodPressure": 66.0,"SkinThick": 29.0,"Insulin": 0.0,"BMI": 26.6,"DiabetesPedFunc": 0.351,"Age": 35.0}}
==========================request end===================================================改为application/json解决了我的问题。
https://stackoverflow.com/questions/59007538
复制相似问题