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='http://kittudemo123.atlassian.net',
username='username',
password= 'password')
attachments_container = confluence.get_attachments_from_content(page_id=33110, start=0, limit=500)
attachments = attachments_container['results']
for attachment in attachments:
fname = attachment['title']
download_link = confluence.url + attachment['_links'['download']
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():
f.write(bits)