Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.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 烧瓶和招摇用户界面不工作?_Python_Swagger - Fatal编程技术网

Python 烧瓶和招摇用户界面不工作?

Python 烧瓶和招摇用户界面不工作?,python,swagger,Python,Swagger,我正在尝试使用Flask和swagger创建一个RESTful应用程序。但是当我运行端点时,我看不到浏览器中记录的方法,例如这里描述的方法 取而代之的是404notfound错误。这是我的密码: def init_deserializer_restful_api(): # Get port number for the web app. PORT = 8000 # Initiate the Flask app app = Flask(__name__)

我正在尝试使用Flask和swagger创建一个RESTful应用程序。但是当我运行端点时,我看不到浏览器中记录的方法,例如这里描述的方法 取而代之的是
404notfound
错误。这是我的密码:

def init_deserializer_restful_api():
    # Get port number for the web app.
    PORT = 8000

    # Initiate the Flask app
    app = Flask(__name__)
    Swagger(app)
    CORS(app)

    # Handler for deserializer
    @app.route("/deserialize", methods=['POST','GET'])
    def handle_deserialization_request():
    # Method description
    # Method content
应用程序运行方式如下:

app.run(port=PORT, host="0.0.0.0")
我运行
http://localhost:8000/deserializer
I get
在服务器上找不到请求的URL。如果手动输入URL,请检查拼写并重试

问题: 1.如何为request.json提供它所需的信息? 2.如何让斯威格上班?

试试看

解释
这是Swagger的默认端点。您试图做的是访问API的一个端点,并期望它呈现招摇过市的UI。Swagger UI是API的附加端点,它列出并允许您尝试所有其他端点。希望有帮助

试试omg它的工作原理,我现在哭了,你能把它作为一个答案吗?如果我没有使用swagger,我如何将json提供给flask?取决于你的API实现。如果它是参数中包含请求的GET方法,您可以直接从浏览器中点击它,否则您将不得不使用POSTMAN(chromeapp)之类的工具来触发POST请求