You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I've been trying to get issue data from the REST API v2 by using cookie based authentication and the python requests library, the /auth/1/session requests returns a 200, cookies are set but all following requests on the same requests.Session object return a 401:
> from requests import Session
> s = Session()
> res = s.post("https://jira.url/jira/rest/auth/1/session",
... json={"username":"user","password":"pass"})
>
> res.status_code
200
> s.cookies
<RequestsCookieJar[<Cookie JSESSIONID=... for jira.url/jira>, <Cookie atlassian.xsrf.token=... for jira.url/jira>]>
> res = s.get("https://jira.url/jira/rest/api/2/issue/ISSUE-100")
> res.status_code
401
> r.request.headers
{'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'JSESSIONID=...; atlassian.xsrf.token=...'}
(In case it's not clear: I removed cookie contents, urls and credentials in the example above)
Furthermore, I get the following message in the response:
os_authType was 'any' and an invalid cookie was sent.
It seems a bit strange; I'm using the same session, which keeps the connection alive by default, and still, the session cookie gets invalidated.
Is this a problem by JIRA or does requests just not actually keep the Session open?
Thanks!
Hi!
Can you try to trace the requests?
logging.basicConfig(level=logging.DEBUG)
I had the same problem here
https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/rest_client.py#L24
After keeping as object it works well.
Sorry, that link shows the current situation, but what was it before? You didn’t subclass object?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.