Closed dillonfromdallas closed 5 years ago
The issue is your use of lists for the points parameter. The .get() is trying to evaluate them as floats, but misses on the conversion because they are wrapped in parentheses. If you are accepting the points through flask you can either a) switch to a post form request, and pass through a list through the form for the two points, or b) you can wrap them in brackets (ie, ['xx.xx', 'yy.yy'], for a python list), and convert to a standard list using either json.loads, or ast.literal_eval(). Then you just slice the received list (list[0], list[1]) for your points to put them into the function. Make sure to use some form of error handling in case your program can't read the inputs.
Hi!
Currently trying to create a Flask route which will take parameters, perform a
populartimes.get()
call, and return the JSONified data.This is the route as-is:
And the current URL:
http://localhost:5000/get?types=bar&p1=(48.132986,%2011.566126)&p2=(48.142199,%2011.580047)
However, this runs into an issue when parsing p1/p2
ValueError: could not convert string to float: '('
How can I make sure I'm properly passing the right values and types into the function, and properly make the call?
requirements.txt