I tried using requests module and atlassian api but always ending up in having another link to download page. I used flyingpdf url in the modules. The code I used is :
import requests
url1 = "https://confluence.xxx.com/confluence/spaces/flyingpdf/pdfpageexport.action?pageId=12345667"
with requests.Session() as session:
session.auth = HTTPBasicAuth('username', 'password')
myfile = session.get(url1, verify=False)
print(myfile.url)
open("C:\\Users\\%current_user%\\Downloads\\trying" + ".pdf", 'wb').write(myfile.content)
Also, when I am using get function in requests module it not even prompting for authentication (tried both ways). The content resulting in myfile.content is some javascript.