Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to upload files to Confluence via Python API

Joe Osborne July 20, 2021

I am attempting to upload zip files to Confluence via Python, but no matter what request I send, I keep getting an error 502 response.  

 

data = {"comment": "This is data"}

files = {'file': open('File.zip', 'rb')}

content = session.post('https://site.com/rest/api/content/2229443766/child/attachment ', data=data, files=files)

print(content.status_code)
print(content.text)

2 answers

1 accepted

1 vote
Answer accepted
Joe Osborne July 20, 2021

Needed to add a header:

 

headers = {"X-Atlassian-Token": "nocheck"}

0 votes
Claudio Andres Torres Burgos April 19, 2023

Could you upload your full solution, please?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events