I'm writing some script to download attachments from JIRA issues. As a proof-of-concept, I went through the JIRA API using cURL (on a windows machine through Cygwin 64 bit) and was able to authenticate and retrieve full representation of an issue (in JSON format) with the following cURL command:
curl -u username:password -k -X GET https://jira.localhost.com/jira/rest/api/2/issue/{issuekey}
HOWEVER, once I started scripting in python (using the requests module) the same request would no longer go through
import requests
from requests.auth import HTTPBasicAuth
r = requests.get("https://jira.wgt.com/jira/rest/api/2/issue/{issueKey}", auth = HTTPBasicAuth(username, password), verify = False)
print response.status_code
print response.text
which prints:
404
{"errorMessages":["Issue Does Not Exist"],"errors":{}}
Using Charles I was also able to see that the server had returned a 301 error (possibly from redirecting https to http?). Maybe requests wasn't able to handle the redirect properly? Any input on how to handle this would be great