Hi
I am trying to automate some tasks using Python script. And I need to connect to our company's Crowd application. I use the following pies of code to connect to Crowd.
But every time it returns 401 response.I am in the crowd-administrators group.Could you please advise on what I am doing wrong.Thanks!
import requestsimport jsoncrowd_url = 'https://*******.com/crowd'username = '*********'password = '***********************'auth_url = f'{crowd_url}/rest/usermanagement/1/session'auth_data = {'username': username, 'password': password}auth_headers = {'Content-Type': 'application/json'}auth_response = requests.post(auth_url, data=json.dumps(auth_data), headers=auth_headers)
resolved the problem via browser_cookie3 python library which takes cookies of the current session from the browser. so I passed cookies with post request
cookies = browser_cookie3.chrome(domain_name='lp-uat.luxoft.com') #get current cookies from the browsercookies_dict = requests.utils.dict_from_cookiejar(cookies) #convert cookies to dict
r = requests.post(crowd_url, json=payload, cookies=cookies_dict)
It looks like you're new here. Sign in or register to get started.