Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda