Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

111
Vistas
POST request returns none in FLASK REST API

Hi I am currently trying to post to my python flask api.

In the frontend I have the following:

function onSubmit() {
  fetch(environment.api + "get-selection", {
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(selection.value),
  });
  console.log(selection.value)
}

In the backend I am just trying to deal with it like this:

@routes.route("/get-selection", methods=["POST", "GET"])
def get_people():
  data = request.get_json()
  # data_json = data["target"]
  print(format(data))

  return "Hello World"

I am currently returning that string because otherwise I get the following error

Error Message

When printing data I just get None...

I already tried request.jsonand request.json()as well as request.get_json and nothing worked so far. For the ones asking how selection.value looks:

selection.value

I really cannot get my head around that problem and hope one of you might have an answers.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda