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

138
Vistas
How to post an image using python requests?

So I am trying to make a post request to a certain website where the request's data has an image, I looked at their source and they do the following:

they first ask you to input the image file using an input element

<input type="file" id="iconImageFile" accept="image/*" name="iconImageFile"/>

then they make a request and send the file

var r = new FormData;
var url = 'their endpoint';
r.append("iconImageFile", $("#iconImageFile")[0].files[0]),
$.ajax({
    url: url,
    type: "POST",
    data: r,
    cache: !1,
    contentType: !1,
    processData: !1
})

My question is how would I be able to replicate such a request using python's requests library? I already have all of the headers needed for verification, I am just confused on how I would send this image in the request.

session.post(url,data = {
    'iconImageFile' : open('icon.png', encoding="utf8", errors='ignore')
})

Any help would be appreciated :D

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