Hello, I am restructuring my python script and with the new structure it is failing to upload certificate to Panorama. I have a working API call: requests.post("https://" + ip + "/api/?&type=import&category=certificate&certificate-name="+certName +"&format=pem&key=" + panapikey, files=file, verify=False) My new structure looks like this: class Panorama : def __makeapi_request ( self , url , data = "" , files = "" 😞 try : response = requests . post ( url , data , files , verify = False , timeout = 10 ) response . raise_for_status () except requests . exceptions . ConnectTimeout as err : print ( "connection error" ) exit ( 1 ) except requests . HTTPError as err : self . error = err # return self.error except BaseException : dom = ET . fromstring ( response . content ) self . error = dom . find ( './/msg' ). text # return self.error else : self . response_xml = response . content self . response_httpcode = response . status_code # return self.response_xml def import_cert ( self , certName 😞 files = {"file": open(certName, "rb")} url = f"https://{self.ip}/api/?" params = {"type":"import","category":"certificate","certificate-name":certName,"format":"pem", "key": self.panapikey} self . __makeapi_request ( url , files = files , data = params ) When I run import_cer(certName) I am always getting the error bellow: <response status = 'error' code = '400'><result><msg>No file uploaded</msg></result></response> I am copy/pasting the values from the working API call, so there should be no typos, also I am testing the import with the same certificate and the same certificate variable. Can someone advise what I am doing wrong ?
... View more