How to send form data to Flask App API Pandas Dataframe

Solution
import numpy as np
import pandas as pd
import time, datetime
from datetime import datetime
import json
from flask import Flask, request, jsonify


#start flask app
app = Flask(__name__)



#Simple flask route to return Value average
@app.route("/api/v1.0/median_val", methods=['POST'])
def med_val():

    r = request.form.to_dict()
    df = pd.json_normalize(r)
    print('incoming keys')
    print(r.keys())

    if r.keys() == {'Value'}: 
        print('keys are good')

        try:

            df = pd.json_normalize(r)
            df['Value'] = df['Value'].astype(float)

            median_val = df.Value.median()
            print('median value == ',median_val)

        except Exception as error:
            print("Internal Sever Error {}".format(error))
            error_str = str(error)
            return error_str, 00

        return json.dumps(median_val)

    else:
        print("Error on api route, rejected unable to process keys") 
        print("rejected unable to process keys")
        return 'Bad Request', 400


if __name__ == '__main__':
    print("Starting main loop")
    app.run(debug=True,port=5000,host="127.0.0.1")
import requests
import pandas as pd
import numpy as np 
from numpy.random import randint


np.random.seed(11)

rows,cols = 50000,1
data = np.random.rand(rows,cols) 
tidx = pd.date_range('2019-01-01', periods=rows, freq='T') 
df = pd.DataFrame(data, columns=['Value'], index=tidx)

median_val = df.Value.median()

print('[INFO]')
print(median_val)


print('[INFO]')
print(df.head())

#create an empty dictionary
baggage_handler = {}

print('[packaging some data!!]')
values_to_send = df.Value.tolist()
baggage_handler['Value'] = values_to_send


print('[Sending to API!]')

response = requests.post('http://127.0.0.1:5000/api/v1.0/median_val', data=baggage_handler)
print("RESPONCE TXT", response.json())
data = response.json()
print(data)