如何将变量从 url 传递给方法
how to pass variable from url to method
鉴于以下 url 我想将 start=8.681495,49.41461 和 end=8.687872,49.420318 作为变量传递给方法测试
1-我如何修改代码以接受可变的起点和终点
2-应该使用哪个动作 GET 或 POST
url
url_2="https://api.openrouteservice.org/v2/directions/driving-car?api_key=5b3ce3597851110001cf62480ecf8c403567479a87de01df5da651fb&start=8.681495,49.41461&end=8.687872,49.420318"
@app.route(url, methods=['GET'])
def test
please note that start and end in the url each take two values lat and
lng respectively..how to use request.args.get in this case-
i want to have a variable for each lat and lng which meand 4 variables
for startlat startlng endlat endlng..
how can i solve it please
使用request.args.get
读取参数
例如获取 api_key
@app.route(url, methpds=['GET'])
def test:
api_key = request.args.get('api_key')
鉴于以下 url 我想将 start=8.681495,49.41461 和 end=8.687872,49.420318 作为变量传递给方法测试 1-我如何修改代码以接受可变的起点和终点 2-应该使用哪个动作 GET 或 POST
url
url_2="https://api.openrouteservice.org/v2/directions/driving-car?api_key=5b3ce3597851110001cf62480ecf8c403567479a87de01df5da651fb&start=8.681495,49.41461&end=8.687872,49.420318"
@app.route(url, methods=['GET'])
def test
please note that start and end in the url each take two values lat and
lng respectively..how to use request.args.get in this case-
i want to have a variable for each lat and lng which meand 4 variables
for startlat startlng endlat endlng..
how can i solve it please
使用request.args.get
读取参数
例如获取 api_key
@app.route(url, methpds=['GET'])
def test:
api_key = request.args.get('api_key')