Extending JIRA Authentication using python-requests

Hi everyone,

I’m trying to create a reporting on demand script using the python library Requests. Basic Auth works! However, I will log in using my credentials but it won’t hold the session. Hopefully people have used this method before to try and pull data, and I’m wondering how you guys solved it. My code is below:

#start session
jiraSession = requests.Session()

username = USERNAME
password = PASSWORD
userData = {‘username’: username, ‘password’: password}
baseURL = ‘https://baseURL.jira.com

jiraSession.post(baseURL+’/rest/auth/1/session’, data=userData)

#This should work theoretically. If Authenticated then an Authenticated only call should pull
r2 = jiraSession.get(baseURL+’/rest/api/2/user/bulk’)
r3 = requests.get(baseURL+’/rest/api/2/user/bulk’, auth=(username, password))
print (r3.text)

Hi @ilallmam,
Did you add cookie seraph.rememberme.cookie returned in response from POST /rest/auth/1/session endpoint as well?

Thanks! We solved it. Let me go ahead and mark this as answered! Thank you :slight_smile: