Atlassian python api, Confluence get_page_as_pdf and export_page giving 404

karthik Panuganti
Contributor
February 4, 2024

Tried this code
confluence = Confluence(
url= atlassian_url, username=username, password=password,
api_version="cloud"
)
with open("output.pdf", "wb") as pdf_file:
pdf_file.write(confluence.export_page("142186113"))

with open("output.pdf", "wb") as pdf_file:
pdf_file.write(confluence.get_page_as_pdf("142186113"))

Both giving error

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/confluence.py", line 3240, in raise_for_status
error_msg = j["message"]
~^^^^^^^^^^^
KeyError: 'message'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/xxxxx/iac/hackathon/confluence-export.py", line 24, in <module>
pdf_file.write(confluence.export_page("142186113"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/confluence.py", line 2568, in export_page
return self.get_page_as_pdf(page_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/confluence.py", line 2544, in get_page_as_pdf
url = self.get_pdf_download_url_for_confluence_cloud(url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/confluence.py", line 2795, in get_pdf_download_url_for_confluence_cloud
progress_response = self.get(poll_url)
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/rest_client.py", line 288, in get
response = self.request(
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/rest_client.py", line 260, in request
self.raise_for_status(response)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/atlassian/confluence.py", line 3243, in raise_for_status
response.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://xxxx.atlassian.net/wiki/services/api/v1/task/327255653/progress

1 answer

0 votes
hemaswapnika_e June 10, 2024

I am also facing the same error

(404 Client Error: Not Found for url: https://infosys.atlassian.net/wiki/services/api/v1/task/796721271/progress)

When trying to access the url - https://infosys.atlassian.net/wiki/spaces/flyingpdf/pdfpageexport.action?pageId=791380304,

facing the following error:

Your request could not be processed because a required security token was not present in the request. You may need to re-submit the form or reload the page.

 

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2024

@karthik Panuganti  @hemaswapnika_e 

please try to create ticket in github

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events