how to download a attachment(excel file) which is attached to jira issue type in python?

rakesh rocckz June 10, 2019

I tried to download the excel file which is attached to jira issue type in python using requests am getting in the html format. please help me how to download the excel file which is attached to jira issue type and save it my local location. i tried like this it is saving it has html file. i need the original excel file which is attached to the jira issue.

 

r = requests.get("jiraurl", headers=headers, verify=False)

request = r.json()

excel_url = request['fields']['attachment'][0]['content'])

#output = when i run the above script am getting the url for the excel sheet were it is located, 

so i tried like this after getting the excel url am doing requests.get again for the excel url

 

r1 = requests.get(excel_url, allow_redirects=True, verify=False)

open('file.xlsx', 'wb').write(r1.content)

when i open the file it is in the html malformed format. please help me how to download the original excel file from python from a jira issue type.

 

2 answers

0 votes
ramesht shukla May 5, 2023

facing same issue

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2021
ramesht shukla May 5, 2023

not very helpful

Suggest an answer

Log in or Sign up to answer