Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!