-1

given the below url i want to to pass the start=8.681495,49.41461 and the end=8.687872,49.420318 as variables to the method test 1-how can i modify the code to accept variable start and end points 2-which action should be used GET or 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 
Amrmsmb
  • 1
  • 27
  • 104
  • 226

1 Answers1

0

use request.args.get to read the parameter

eg to get the api_key

@app.route(url, methpds=['GET'])
def test:
     api_key = request.args.get('api_key')

sahasrara62
  • 10,069
  • 3
  • 29
  • 44
  • 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 – Amrmsmb Mar 09 '21 at 09:41
  • `start1, start2 = request.args.get('start').split(',')` – sahasrara62 Mar 09 '21 at 09:47