Upload gcode from https

What is the problem?

I don't know how to upload a file directly from an HTTPS url

What did you already try to solve it?

I made a python script like this

import requests as rq

url = r'https://somebigrepdomain.org:5000/api/files/local?apikey=someapikeyihave'
gcode = r'https://somedomain.org/raw/file1.gcode'
data = rq.get(gcode)
upload = {'file': data.content,}
r = rq.post(url, files=upload)

Of course I get the error "Could not upload the file 'file', invalid type", status code 400

Have you tried running in safe mode?


Did running in safe mode solve the problem?


Complete Logs

octoprint.log, serial.log or output on terminal tab at a minimum, browser error console if UI issue ... no logs, no support! Not log excerpts, complete logs.)


Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

windows 10, BigRep ONEv3

are you redirecting the folder /5000/ through some form of reverse proxy? If not then you need to use the URL below.


that was a typo
corrected in OP

This worked

# abbreviated...

upload = {'file': ('coolfilename.gcode', data.text),}

# ...