问题描述
我有一个关于通过POST通过CURL发送数据和通过URL发送数据的问题。更一般地说,我有一个烧瓶路线
@ app.route('/ create',methods = ['POST'])
def clone:
...
我怎样才能发送数据一个URL?我想这样做:
pre $ lt; code>< my-server>:port / create / arg1 / arg2 / arg3
我刚才发现你可以做一些类似于
@ app.route( '/创建',方法= [ 'POST'])
@ app.route('/创建/< OP> /<信源> /< target>,methods = ['GET'])
def clone(op = None,source = None,target = None):
...
哪个会起作用。这是一个很好的方法吗?
要访问实际的查询字符串( 访问已知的查询参数: 如果你正在寻找像 I have a question regarding sending data via a CURL through POST and sending data through the URL. More generally, I have a flask route How can I also send data using a URL? I want to do something like this: I just figured out you can do something like Which will work. Is this a good approach? To access the actual query string (everything after the To access known query parameters: If you're looking to use variables sent like 这篇关于蟒蛇烧瓶通过邮件和网址发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! code $)使用:
$ p $ / create',methods = ['POST'])
def clone:
return request.query_string
来自瓶子导入请求
@app .route('/ create',methods = ['POST'])
def clone:
user = request.args.get('user')
/ arg1 / arg2 / arg3
这样的变量,使用:
@ app.route( '/创建/< ARG1> /< ARG2> /< ARG3>',方法= ['POST'])
def clone(arg1,arg2,arg3):
...
@app.route('/create', methods=['POST'])
def clone:
...
<my-server>:port/create/arg1/arg2/arg3
@app.route('/create', methods=['POST'])
@app.route('/create/<op>/<source>/<target>', methods=['GET'])
def clone(op = None, source = None, target = None):
...
?
) use:from flask import request
@app.route('/create', methods=['POST'])
def clone:
return request.query_string
from flask import request
@app.route('/create', methods=['POST'])
def clone:
user = request.args.get('user')
/arg1/arg2/arg3
use:@app.route('/create/<arg1>/<arg2>/<arg3>', methods=['POST'])
def clone(arg1, arg2, arg3):
...