Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/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
Api 自定义访问connexion(python)服务的服务器url时返回的消息_Api_Rest_Service_Python 3.6_Connexion - Fatal编程技术网

Api 自定义访问connexion(python)服务的服务器url时返回的消息

Api 自定义访问connexion(python)服务的服务器url时返回的消息,api,rest,service,python-3.6,connexion,Api,Rest,Service,Python 3.6,Connexion,我正在用编写一个python服务。我可以通过localhost:/ui访问服务的招摇过市gui。但是,当我在没有/ui(由connexion添加)的浏览器中输入localhost:时,我会收到以下消息: { "detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try agai

我正在用编写一个python服务。我可以通过
localhost:/ui
访问服务的招摇过市gui。但是,当我在没有
/ui
(由connexion添加)的浏览器中输入
localhost:
时,我会收到以下消息:

{
  "detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
  "status": 404,
  "title": "Not Found",
  "type": "about:blank"
}
是否可以自定义此消息?在本例中,我希望
localhost:
返回以下消息:

{"message": "check /ui to have access to the Swagger UI"}

我想我找到了解决办法。只需将以下内容添加到openspec api中:

  /:
    get:
      operationId: path.to.function
      summary: "my personlized message"
      responses:
      ......