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.
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