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

Problems while using attach_file method in confluence #1442

Open
jbtescudeiro16 opened this issue Aug 20, 2024 · 0 comments
Open

Problems while using attach_file method in confluence #1442

jbtescudeiro16 opened this issue Aug 20, 2024 · 0 comments

Comments

@jbtescudeiro16
Copy link

jbtescudeiro16 commented Aug 20, 2024

Recently, I had to create some pages on confluence using a python script. Two pages contain Images. The first time that I attach the image to the page, there's no problem, but when I try and create again the pages and attach files with the same name, it gives me an error. I was expecting that uploading an image with an existing name, a new revision of the image would be created, but that doesn't seems the case.
The version i'm using is :
atlassian-python-api v1.41.14

The error is :
Error while conecting to Confluence org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only

The code i'm using is :

for filename in os.listdir("OutputMD/"):
       file_path = os.path.join("OutputMD/", filename)
       MD_content = read_file_content(file_path)
       page_title = os.path.splitext(filename)[0]
       newpagestats= confluence.update_or_create(page_id, page_title, MD_content, representation='wiki',editor='v2', full_width=True)
       print(newpagestats["id"])
       if page_title in aux_dict:
           for i in aux_dict[page_title]:
               print("Attach files trying")
               confluence.attach_file("Photos/" + i, name=i, content_type=None, page_id=newpagestats["id"], title=page_title,space=None, comment=None)
       print("Page "+ page_title + " created!")
   print("Pages Created!")
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