Skip to content

Commit

Permalink
[Confluence] forward start and limit for getting attachments (#1384)
Browse files Browse the repository at this point in the history
Co-authored-by: slu <[email protected]>
  • Loading branch information
chillmastercoder and slu authored May 20, 2024
1 parent e0407e6 commit bba9e38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,17 +1315,20 @@ def attach_file(
comment=comment,
)

def download_attachments_from_page(self, page_id, path=None):
def download_attachments_from_page(self, page_id, path=None, start=0, limit=50):
"""
Downloads all attachments from a page
:param page_id:
:param path: path to directory where attachments will be saved. If None, current working directory will be used.
:param path: OPTIONAL: path to directory where attachments will be saved. If None, current working directory will be used.
:param start: OPTIONAL: The start point of the collection to return. Default: None (0).
:param limit: OPTIONAL: The limit of the number of attachments to return, this may be restricted by
fixed system limits. Default: 50
:return info message: number of saved attachments + path to directory where attachments were saved:
"""
if path is None:
path = os.getcwd()
try:
attachments = self.get_attachments_from_content(page_id=page_id)["results"]
attachments = self.get_attachments_from_content(page_id=page_id, start=start, limit=limit)["results"]
if not attachments:
return "No attachments found"
for attachment in attachments:
Expand Down

0 comments on commit bba9e38

Please sign in to comment.