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 requests
import json
crowd_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 browser
cookies_dict = requests.utils.dict_from_cookiejar(cookies) #convert cookies to dict
r = requests.post(crowd_url, json=payload, cookies=cookies_dict)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.