This is my request.py file
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"})
This is part of my app file and the predict function which I want take the above inputs and convert to objects which would be the input parameters to my ml model
@app.route('/predict',methods=['POST'])
def predict():
r1=request.json
r1=str(r1)
y = json.loads(r1)
city = y["City"]
Country = y['Country']
Target_PtoD = y['Target_PtoD']
start = y['Start_date']
end = y['End_date']
But I keep getting an error
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
when loading the inputs. Is there a better way to do this