Flask==1.1.1 pymongo==3.10.1 flask-restplus==0.13.0
我正在尝试将JSON放到URL并使用,但我遇到了一个问题。在 routes.py 我有一个简单的API设置...update()
@api.route('/api/content/<idx>')
class UpdateContent(Resource):
def put(self,idx):
data = api.payload
Content.objects(content_id=idx).update(**data)
return jsonify(Content.objects(content_id=idx))
使用Postman I are PUTting to /api/content/2
{
"content_id": 2,
"title": "Test 2",
"description": "Test 2"
}
我收到这个...
Traceback (most recent call last):
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask_restplus/api.py", line 584, in error_router
return original_handler(e)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/_compat.py", line 38, in reraise
raise value.with_traceback(tb)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/jyoseph/Sites/testsite/venv/lib/python3.8/site-packages/flask_restplus/api.py", line 584, in error_router
return original_handler(e)
偶然的你
相关分类