Unsolved
1 Rookie
•
11 Posts
0
2491
Python REST API Unity login
Hi Experts,
I am trying to write a Python code that login to the Unity and capture a few details. I do however had challenges capturing the token on response header EMC-CSRF-TOKEN.
What am I doing wrong on the below script?
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Charset': 'utf-8',
'Accept-Encoding': 'gzip',
'Connection': 'Keep-Alive',
'Authorization': auth,
}
urllib3.disable_warnings(InsecureRequestWarning)
response = r.get('https://MYUNITYIP/api', headers=headers, verify=False)
response.raise_for_status()
token = response.headers.get('EMC-CSRF-TOKEN ')
DELL-Sam L
Moderator
Moderator
•
7.1K Posts
0
May 27th, 2020 12:00
Hello ErwinF,
Here is a link to a KB that way help. You will need to login in with your EMC account. https://dell.to/2M2Qvym
Please let us know if you have any other questions.
vengle
3 Posts
0
November 23rd, 2020 11:00
Did you ever get a python specific answer? I'm looking at the same task now and would love to see some example working python code to manage a session with a unity array.
Chris_Cisco
4 Posts
0
June 17th, 2022 15:00
This is an old topic, but I'm having the same problem. Does anyone have a working python3 script example to capture the token?
Thank you
Chris
Rainer_EMC
8.6K Posts
0
July 11th, 2022 05:00
maybe a look at the existingt Python libs could help
https://github.com/ktelep/EMCUnity
https://github.com/emc-openstack/storops