Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I POST attachment using python request( not curl)

Sara Lloud March 28, 2018

I'm trying to attach photo to task using requests:

headers = {'X-Atlassian-Token': 'no-check',
'Authorization': 'Basic %s' % user_token,
'Content-Type': 'application/json'}
files = {'media': open(path_to_file, 'rb')}
url = "https://{}/rest/api/2/issue/{}/attachments".format(host, task_key)
result_attach = requests.post(url, files=files, headers=headers)

But I get reponse 415 

1 answer

1 vote
Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2018

415 seems weird since you're choosing a content type... Try removing the single quotes around 'no-check'. Or maybe try passing the header as a whole string?

Sara Lloud March 29, 2018

No, this part is ok

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events