I’m working in some automation and one of the things I needed to solve was a script to download JIRA attachments with Python, here’s how I did it.

Using the REST API of JIRA and some python modules:

We start defining the she-bang, author, modules and variables that we’ll need before:

Using ‘requests’ to perform the connection to JIRA:

Now we validate if there are attachments and if our desired attachment is present and then form the URL of the attachment to be downloaded:

Once we validated the file is present we download it (I’ve added UTF8 support because of my specific needs):

And that’s it.