Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get attachment from comment? #1382

Closed
Irishery opened this issue May 19, 2022 · 1 comment · Fixed by #1404
Closed

How to get attachment from comment? #1382

Irishery opened this issue May 19, 2022 · 1 comment · Fixed by #1404
Assignees
Labels

Comments

@Irishery
Copy link

I want to download image from comment via api, but only that I can get is a string name of image in body like body: "!image-2022-05-19-19-58-23-624.png!". Is there any possible ways to do it?

@billga
Copy link

billga commented May 31, 2022

Yes. Since you can already get at the comments you're halfway there. With the string you found in the comment, search through the attachments on that issue to get the item you want:

# jc is your jira client, ABC-123 is your issue key
issue = jc.issue('ABC-123', fields='attachment')
for item in issue.fields.attachment:
    print(f"{item.filename}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants