-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJIRA_DownloadAttachmentsv2.py
More file actions
36 lines (28 loc) · 1.02 KB
/
JIRA_DownloadAttachmentsv2.py
File metadata and controls
36 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from jira import JIRA
def download_attachment():
#Enter JIRA Username
username = ''
#Enter JIRA UserAPIToken
apitoken = ''
download_folder = input('Enter the folder to download the attachments to:\n')
#Enter JIRA URL
server = ''
#issue_key = ''
issue_key = input('Enter the ticket number:\n')
jira = JIRA(basic_auth=(username,apitoken),options={'server':server})
issue = jira.issue(issue_key,fields='summary,comment,attachment')
for attachment in issue.fields.attachment:
with open(download_folder + '%s' % (attachment.filename), 'wb') as file:
file.write(attachment.get())
process = True
begin_input = input('Enter "Y" to begin the process:\n')
while process == True:
if begin_input == 'Y':
download_attachment()
process_input = input('Need to process the script again?\nEnter "Y" or "N":\n')
if process_input == 'Y':
download_attachment()
else:
process = False
else:
print('"Y" was not selected\nExiting the script...')