Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confluence: Upload attachment not possible #782

Open
Mordecaine opened this issue May 17, 2021 · 0 comments
Open

Confluence: Upload attachment not possible #782

Mordecaine opened this issue May 17, 2021 · 0 comments

Comments

@Mordecaine
Copy link

Hello,

I try to upload a file to a confluence site with the following code

    confluence = Confluence(
        url="https://confluence.example.com",
        username="username",
        password="password",
    )

    response = confluence_object.attach_file(
            "/tmp/mypdf.pdf,
            content_type="application/pdf",
            name="mypdf",
            page_id="151685342",
            title="mypdf",
            space='SPKD',
            comment="test"
        )

If I use this command, I get the following error:

Traceback (most recent call last):
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/atlassian/confluence.py", line 1029, in attach_content
    files={"file": (name, content, content_type)},
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/atlassian/rest_client.py", line 312, in post
    absolute=absolute,
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/atlassian/rest_client.py", line 236, in request
    response.raise_for_status()
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error:  for url: https://***********************/rest/api/content/151685342/child/attachment
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 136, in upload
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/atlassian/confluence.py", line 1100, in attach_file
    comment=comment,
  File "/home/t1-*******/PycharmProjects/CQ-deploy-reports/venv/lib64/python3.6/site-packages/atlassian/confluence.py", line 1037, in attach_content
    reason=e,
atlassian.errors.ApiError: Attachments are disabled or the calling user does not have permission to add attachments to this content
report.upload_page_id
'151685342'

If I use the API without the module, it works really nice.

Is this a bug or is the bug in my mind?

Cheers,
Mordecaine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant