Curl 烧瓶API要卷曲

Curl 烧瓶API要卷曲,curl,flask,python-requests,postman,Curl,Flask,Python Requests,Postman,我编写了一个烧瓶API,如下所示: @app.route('/train/add_message/<uuid>', methods=['GET', 'POST']) def add_message(uuid): content = request.get_json(silent=True) 这是输出 -----------开始----------- 如何将其转换为curl命令。我试过这个,但出了一个错误 curl --location --request POST myip

我编写了一个烧瓶API,如下所示:

@app.route('/train/add_message/<uuid>', methods=['GET', 'POST'])
def add_message(uuid):
    content = request.get_json(silent=True)
这是输出

-----------开始-----------

如何将其转换为curl命令。我试过这个,但出了一个错误

curl --location --request POST myip+'/train/add__message/1234' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-raw '{
    "type":1,
    "project_id":"313",
    "data":[{"label5":{
            "example1":{
                "key":"hi11",
                "key2":"$key2"
            },
            "example2":{
                "key":"hi12",
                "key2":"$key2"
            },
            "example3":{
                "key":"hi3",
                "key2":"$key2"
            }
        }
            }]
}'

This is the error I got:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>
curl--location--request POST myip+'/train/add\u message/1234'\
--标题“内容类型:应用程序/x-www-form-urlencoded”\
--数据原始'{
“类型”:1,
“项目id”:“313”,
“数据”:[{“label5”:{
“示例1”:{
“密钥”:“hi11”,
“key2”:“$key2”
},
“示例2”:{
“密钥”:“hi12”,
“key2”:“$key2”
},
“示例3”:{
“密钥”:“hi3”,
“key2”:“$key2”
}
}
}]
}'
这是我得到的错误:
405方法不允许
方法不允许
请求的URL不允许使用该方法


尝试添加
Accept
标题

curl --location --request POST myip+'/train/add__message/1234' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/x-www-form-urlencoded' \
--data-raw '{
    "type":1,
    "project_id":"313",
    "data":[{"label5":{
            "example1":{
                "key":"hi11",
                "key2":"$key2"
            },
            "example2":{
                "key":"hi12",
                "key2":"$key2"
            },
            "example3":{
                "key":"hi3",
                "key2":"$key2"
            }
        }
            }]
}'


你能试着把火车前面的车门拆下来吗?您的卷发中还有一个,但烧瓶应用程序@MAS中没有
curl --location --request POST myip+'/train/add__message/1234' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-raw '{
    "type":1,
    "project_id":"313",
    "data":[{"label5":{
            "example1":{
                "key":"hi11",
                "key2":"$key2"
            },
            "example2":{
                "key":"hi12",
                "key2":"$key2"
            },
            "example3":{
                "key":"hi3",
                "key2":"$key2"
            }
        }
            }]
}'

This is the error I got:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>
curl --location --request POST myip+'/train/add__message/1234' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/x-www-form-urlencoded' \
--data-raw '{
    "type":1,
    "project_id":"313",
    "data":[{"label5":{
            "example1":{
                "key":"hi11",
                "key2":"$key2"
            },
            "example2":{
                "key":"hi12",
                "key2":"$key2"
            },
            "example3":{
                "key":"hi3",
                "key2":"$key2"
            }
        }
            }]
}'