I have the code for the following url:http://localhost/summary/myfile.csv I want the url to look like this:http://localhost/summary?file=myfile.csv
The code is to be written in flask.
My code for the first url is as follows:
@app.route('/summary/<filename>',methods = ['GET'])
def api_summary(filename):
url = 'C:\\Users\\Desktop\\myproject\\'
if os.path.exists(url + filename):
data = pandas.read_csv( url + filename)
Numeric_Summary = data.describe().to_dict()
resp = jsonify(Numeric_Summary)
resp.status_code = 200
return resp