- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-12-2022 01:32 PM
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:
09-13-2022 02:53 AM
Hi @Krasen.kolev, I was able to get the code working with changing
response = requests.post(url, data, files, verify=False, timeout=10)
to
response = requests.post(url, data=data, files=files, verify=False, timeout=10)
although there may be other/better ways to modify the code.
Hope that helps!
09-13-2022 02:53 AM
Hi @Krasen.kolev, I was able to get the code working with changing
response = requests.post(url, data, files, verify=False, timeout=10)
to
response = requests.post(url, data=data, files=files, verify=False, timeout=10)
although there may be other/better ways to modify the code.
Hope that helps!
09-13-2022 03:16 AM
Hi @JimmyHolland,
Thanks for your reply!
My issue is that when I use directly the post request, everything is working fine. However, I am modifying my code to start using the private function "__makeapi_request".
so when I call function import_cert(certName), which in turn is calling __makeapi_request(url, files=files, data=params) I get the error:
"<response status = 'error' code = '400'><result><msg>No file uploaded</msg></result></response>".
To me it seems that when I use the private function(__makeapi_request), Panorama does not take into account the provided file.
I tried multiple different variations to pass the data, but all of them resulted with the error above.
09-13-2022 03:27 AM - edited 09-13-2022 03:27 AM
Yes, the modification I mentioned is within the __makeapi_request function's code
Here is my test of the code: https://github.com/jamesholland-uk/playground/blob/main/python/upload-cert-to-panorama.py
09-13-2022 07:29 AM
Sorry, I didn't realized it.
Just tested it and it is working fine! Thanks for the help!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!