Please, run the following in Python:
# ===============
# greeting.txt
# ===============
hello, world
# ===============
# upload.attachment.py
# ===============
import requests
import json
# [JIRA-BASE-URL], i.e.: http://localhost:8080
# [ISSUE-ID], i.e.: ATT-1
url = '[JIRA-BASE-URL]/rest/api/2/issue/[ISSUE-ID]/attachments'
headers = {"X-Atlassian-Token": "nocheck"}
# please uncomment to attach external file
files = {'file': open('greeting.txt', 'rb')}
# upload file to issue
# [USERNAME], i.e.: admin
# [PASSWORD], i.e.: admin
r = requests.post(url, auth=('[USERNAME]', '[PASSWORD]'), files=files, headers=headers)
print(r.status_code)
print(r.text)
If you find this answer useful, I would kindly ask you to like and share it so the same will be visible to others who might be facing the same issue you have inquired.
Thank you for your understanding.
No comments:
Post a Comment
Thanks for your comments