i have this code on server side
from flask import Flask, request, jsonify
app=Flask(__name__)
@app.route("/pingtest")
def pingtest():
return "Pong!"
@app.route("/registrar_alumno", methods=["POST"])
def registrar_alumno():
print(request.json)
return jsonify(request.json)
app.run(debug=True,port=4000)
and on the client i have this code
import requests
r=requests.post("http://127.0.0.1:4000/registrar_alumno",
data={"test":"hello there"})
print(r.text)
i expect to obtain {"test":"hello there"} in both sides but i have this on server:
(asistencias) PS C:\Users\Alumno\Desktop\Proyectos\py\gestion_academica\asistencias> python .\server.py [...] (irrelevants messages that server always shows)
None #...(this should be print(request.json) instruction)
127.0.0.1 - - [15/Mar/2020 16:22:45] "←[37mPOST /registrar_alumno HTTP/1.1←[0m" 200 -
and this on client
(asistencias) PS C:\Users\Alumno\Desktop\Proyectos\py\gestion_academica\asistencias> python .\testclient.py
None
i have no idea what's wrong with this, i hope someone can help me to found the bug
Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)
– Jose facundo Bogado Mar 15 '20 at 20:10