小编Anm*_*dal的帖子

WSGIRequest 对象没有属性 PUT

我正在尝试使用 curl 的 put 请求向本地服务器发出 put 请求:

curl -X PUT -H "Content-Type: application/json" -d '{"connid":"12"}' "127.0.0.1:8000/api/kill"
Run Code Online (Sandbox Code Playgroud)

我收到相同的回复:

'WSGIRequest' 对象没有属性 'PUT'

对于以下代码:

def kill(req):
  conid = req.PUT['connid']
  statusres = {}

  if conid in state:
    error[conid] = 'true'
    statusres['status'] = 'ok'

  else:
    statusres['status'] = 'invalid connection Id : '+ conid
  return JsonResponse(statusres)
Run Code Online (Sandbox Code Playgroud)

@csrf_exempt之前也用过这个函数。

python django json wsgi put

3
推荐指数
1
解决办法
4482
查看次数

标签 统计

django ×1

json ×1

put ×1

python ×1

wsgi ×1