Hi,
we are using some python scripts to download the attachments from JSM(Data Centre Version),
, but is giving the below message,
error code : 403
message : You do not have the permission to see the specified issue
The user credentials used to access the JSM is Admin Credentials and all permission are granted to the administrator in the project.
i have added the code here:
#downloadFile from jira server
def downloadFile(jIssueID,extension):
appConfig = kms.appConfig
fileLocation=appConfig["configuration"]
jiraConfig = kms.systemConfig
jiraConfig=jiraConfig["JiraConfig"]
logger.infoLog("Starting DOWNLOAD file function")
directory=fileLocation["Attachments-Path"]+jIssueID
if not os.path.exists(directory):
os.makedirs(directory)
# else:
# for file in os.listdir(directory):
# if file.endswith(".htm"):
# return directory+"/"+file
try:
headers={
"Accept":"application/json",
"Content-Type":"application/json"
}
url=jiraConfig["url"]+"/"+jIssueID #url : https://jsmuat.qwikcilver.com/rest/api/2/issue/
response=requests.get(url,headers=headers,auth=(jiraConfig["id"],jiraConfig["password"]))
logger.infoLog(response)
logger.infoLog(response.text)
attachment=response.json()["fields"]["attachment"]
fileFound = False
if attachment:
for i in attachment:
if extension in i["filename"].lower():
file=requests.get(i["content"],auth=(jiraConfig["id"],jiraConfig["password"]))
#logger.infoLog("Saving file at: "+directory+"/"+i["filename"])
if os.path.exists(directory+"/"+i["filename"]):
os.remove(directory+"/"+i["filename"])
open(directory+"/"+i["filename"],'wb').write(file.content)
fileFound = True
return directory+"/"+i["filename"]
if not fileFound:
logger.infoLog("No Attachment Found- Further Process Terminated")
return "Not Found"
except Exception as e:
#print(str(traceback.format_exc()))
Please guide me in resolving the issue