Start a Conversation

Unsolved

1 Rookie

 • 

11 Posts

2491

May 26th, 2020 05:00

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 ')

 

Moderator

 • 

7.1K Posts

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.

3 Posts

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.

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

8.6K Posts

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

 

No Events found!

Top