I am new to flask and I have been trying to figure this out for fews days
This is my request.py
import requests
url = 'http://localhost:5000/predict_api'
r = requests.post(url,json={'City':'Berlin', 'Country':'DE', 'Target_PtoD':36,'Start Date':"1/8/2021",'End Date':"14/8/2021"})
I want to store the inputs from the post to object variables like below. When I manually assign variables in the code like below, it works but when I try get it from the request. I get errors
city = 'Berlin'
Country='DE'
Target_PtoD=36
start='14/7/2021'
end='31/7/2021'
I have tried the following
@app.route('/predict',methods=['GET','POST'])
def predict():
city = request.values.get('City')
Country=request.values.get('Country')
Target_PtoD=request.values.get('Target_PtoD')
start=request.values.get('Start Date')
end=request.values.get('End Date')
But for some reason the wrong input gets stored.
Anyone familiar with this, request your kind help.