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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

download file from my confluence page using python.

HI , I was trying to develop a script that download files from my confluence page , As of now i used python atlassian library and request module, But keep getting 401 even though i provided valid username and password 


My code

from atlassian import Confluence
import requests
from requests.auth import HTTPBasicAuth 
import urllib.request 
confluence = Confluence(url='',  
attachments_container = confluence.get_attachments_from_content(page_id=33110, start=0, limit=500)
attachments = attachments_container['results']
for attachment in attachments:       
 fname = attachment[
download_link = confluence.url + attachment[
    r = requests.get(download_link, auth = HTTPBasicAuth(confluence.username,confluence.password))
if r.status_code == 200:   
with open(fname, "wb"as f:    
for bits in r.iter_content():   

1 answer

0 votes
Diego Atlassian Team Jan 22, 2021

Hello @Naveen Vb!

I was able to find a thread on Stackoverflow, outside our community, that answers your request:

Looking at the code you provided, it seems that you have already looked into it! So, I would start by checking the authentication method and credentials that you are using.

If you want to, you can also raise your question in our Sister Community, the developer community! Here, take a look:

Let us hear from you!

Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,749 views 8 32
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you