Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 错误的HTTP状态代码:422_Python 2.7_Tornado - Fatal编程技术网

Python 2.7 错误的HTTP状态代码:422

Python 2.7 错误的HTTP状态代码:422,python-2.7,tornado,Python 2.7,Tornado,我正在使用Tornado编写RESTAPI 试图使用 raise tornado.web.HTTPError(422) 获取此错误 Bad HTTP status code: 422 请帮助解决此问题,web.py的来源如下: if e.status_code not in httplib.responses: logging.error("Bad HTTP status code: %d", e.status_code) self.send_error(500) 我们是否应该

我正在使用Tornado编写RESTAPI

试图使用

raise tornado.web.HTTPError(422)
获取此错误

Bad HTTP status code: 422

请帮助解决此问题,web.py的来源如下:

if e.status_code not in httplib.responses:
   logging.error("Bad HTTP status code: %d", e.status_code)
   self.send_error(500)

我们是否应该怀疑422在tornado上不被视为合适的状态?

是的,您已经收到了您提出的错误。。。听起来一切都很好。好的,我来解释一下。我需要返回这段代码,即使它不在httplib中,您也不能这样做?您正在编写WebDAV服务器吗?因为如果不是,这是错误的代码。如果你必须拥有它,试试self。写错误(422)而不是提高。谢谢。它解决了我的问题
self.set_status(422,reason='Need to set 422')