title: Python request.session JIRA "You do not have the permission to see the specified issue"
body: <p>Firstly, I am aware of the solution presented here: <a href="https://stackoverflow.com/questions/28434628/jira-rest-api-to-get-work-log-you-do-not-have-the-permission-to-see-the-speci">JIRA REST API to get work log - &quot;You do not have the permission to see the specified issue&quot;</a> ... As well the <a href="https://blog.nick.josevski.com/2016/04/08/jira-cookie-based-auth-api-calls-in-f-with-restsharp/" rel="nofollow noreferrer">linked</a> blog post (<em>penned by</em> @Nick Josevski), which whilst useful, doesn't address my specifc problem, which could be something trivial...</p>
  
  <p>With following <strong>Python 2.7.3</strong> code... </p>
  
  <pre><code>import requests
  import getpass
  import json
  
  jira_user = raw_input("Username: ")
  jira_pass = getpass.getpass()
  
  session = requests.Session()
  session.verify = jira_ca_certs # Our internal certs
  auth_info = {"username": jira_user, "password":  jira_pass}
  login_url = 'http://JIRA_SERVER.com/login.jsp'
  session.post(login_url, data=auth_info)
  </code></pre>
  
  <p>I generate the cookies post basic authenticatation to jira (note: <em>I am using "http" without specifying the PORT to authenticate with the login page</em>).. As session automatically holds the returned cookies, I can use <em>session.cookies</em> to set the header:</p>
  
  <pre><code>cookies = requests.utils.dict_from_cookiejar(session.cookies)
  headers = {'Content-type': 'application/json', 'cookie': cookies}
  </code></pre>
  
  <p>Following which, I test the captured cookies with a basic get to the secure JIRA url, using <strong>https</strong> + <strong>PORT</strong>:</p>
  
  <pre><code>base = session.get('https://JIRA_SERVER.com:1234', headers=headers)
  print 'base: ', base
  </code></pre>
  
  <p>The above, as expected, returns (<em>though this might not be a valid test?</em>) ...</p>
  
  <pre><code>base:  &lt;Response [200]&gt;
  </code></pre>
  
  <p>Now to test the code for it's <em>intended purpose</em>. I extend the url for a specific JIRA issue, using the same approach:</p>
  
  <pre><code>jira = session.get('https://JIRA_SERVER.com:1234/rest/api/latest/issue/KRYP-6207', headers=headers)
  print 'issue: ', jira
  print jira.json()
  </code></pre>
  
  <p>With JSON output, I get a response stating I <em>do not have the permission</em>:</p>
  
  <pre><code>issue:  &lt;Response [401]&gt;
  {u'errorMessages': [u'You do not have the permission to see the specified issue.', u'Login Required'], u'errors': {}}
  </code></pre>
  
  <p>The cookies returned, that I use in the header, are: </p>
  
  <pre><code>headers:  {'cookie': 'atlassian.xsrf.token=XXXXXXXXXXXXXXXX|lout; Path=/, JSESSIONID=XXXXXXXXXXXXXXXX; Path=/'}
  </code></pre>
  
  <p>I don't know <em>why</em> this works for the <em>base</em> url, but not the <em>issue</em> url.. I have used <em>Chrome POSTMAN</em> to check the cookies being returned, and they are the same as those listed above i.e. atlassian.xsrf.token, and JSESSIONID.</p>
  
  <p>Hoping someone here can tell me what I am doing wrong! Thanks in advance ...</p>