Hi all,
I want to upgrade 6300 switches using the API in a python script.
At the moment I always get the response error code 500 "Message Error processing the form."
My main question is: Is the image being sent binary in the post request or is only a download link being sent?
The API v10.04 documentation doesn't help:
https://support.hpe.com/hpesc/public/docDisplay?docLocale=en_US&docId=emr_na-a00091710en_us
The documentation on the switch is not very helpful either ( https://{switch_ip}/api/v10.04/ ), but it shows the, what I assume, correct content type 'multipart/form-data'.
here is my curent code, maybe someone can spot the problem quickly:
def upgrade(firmware: str, partition: str = 'primary', **session_dict):
target_url = session_dict["url"] + "firmware?image={}".format(partition.lower())
firmware = os.path.abspath(firmware)
params = (
('image', 'secondary'),
)
files = {'file': open(firmware, 'rb')}
headers = {
'accept': '*/*',
'Content-Type': 'multipart/form-data',
}
r = session_dict['s'].post(target_url, files=files, headers=headers, params=params, verify=False)
Thanks,
Bjarne