I’m receiving a 401 Unauthorized error when trying to post attachments to the Jira Cloud.
my code in python:
##################################################
import glob
import requests
import json
import time
def upPagare(pagare):
tmp = pagare.split('.')
noAct = tmp[0]
url = 'https://pochteca.atlassian.net/rest/api/2/issue/'+noAct+'/attachments'
headers = {"X-Atlassian-Token": "nocheck"}
# please uncomment to attach external file
files = {'file': open(pagare, 'rb')}
r = requests.post(url, auth=('aferreirao@pochteca.com.mx', 'lalala'), files=files, headers=headers)
print(r.status_code)
print(r.text)
pagares = [f for f in glob.glob("*.pdf")]
for x in range(len(pagares)):
print("updating :" + pagares[x])
upPagare(pagares[x])
print("success:" +pagares[x])
time.sleep(10)
#################################################
I almost try with Curl:
##############################################
curl -D- -u aferreirao@pochteca.com.mx:lalala -X POST -H "X-Atlassian-Token: nocheck" -F "file=@C:\Users\aferreirao\Desktop\CAP-16041.pdf" https://pochteca.atlassian.net/rest/api/2/issue/CAP-16041/attachments
################################################
Even better would be improving the create-link dialog to let you pick a page, then choose to show either:
...then the system would build the URL internally so we don't have to mess with it. ![]()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.