Downloading an attachment from a jira issue using jira-python

Ishan Shah April 20, 2016

So, 

I am trying to download a file from JIRA ticket using jira-python, but I did find any userful information for that. 

Has anybody done it so far ? 

--Ishan

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Guy Matz July 1, 2016

Try something like this:

issue = jira.issue('JCD-6585')
attachment = issue.fields.attachment[0]
image = attachment.get()
with open('/tmp/Issue1_CA_JCD_6585.png', 'wb') as f:
    f.write(image)

 

Darren McElfresh November 10, 2016

For me I found that you have to also ask for expanding attachment in order for this to work.

issue = jira.issue('JCD-6585', expand="attachment")
...
0 votes
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2016

I do not you Pyton at all, just read documentation. Have you tried to use 

attachment(id)[source] 

Get an attachment Resource from the server for the specified ID?

Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2016
TAGS
AUG Leaders

Atlassian Community Events