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

248
Vistas
How send post request and get file? Python Django

One site пenerating iPXE build imagea file that I need to download by sending a request.

I want to make a request for a post on the 3th site (rom-o-matic.eu), and get a file from site. Is this possible?

My example is this:

def requestPOST(request):
    values = {'wizardtype': 'standard', 
    'outputformatstd': 'bin/ipxe.usb', 
    'embed': '#!ipxe dhcp route}', 
    'gitrevision': 'master'}

    r = requests.post("https://rom-o-matic.eu/", verify=False, data={values})
    return()

What should this return?

Thanks.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

import requests
import shutil

def downloadPOST(outpath):
    values = {
        'wizardtype': 'standard', 
        'outputformatstd': 'bin/ipxe.usb', 
        'embed': '#!ipxe dhcp route}', 
        'gitrevision': 'master',
    }

    r = requests.get("https://rom-o-matic.eu/", data={values}, verify=False, stream=True)

    if r.status_code != 200:
        raise ValueError('Status code != 200')

    with open(outpath, 'wb') as f:
        r.raw.decode_content = True
        shutil.copyfileobj(r.raw, f)  

Based on How to download image using requests

over 4 years ago · Santiago Trujillo Denunciar
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