Skip to content

Commit

Permalink
[Confluence] forward start and limit for getting attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
slu committed May 6, 2024
1 parent 591ca2c commit 363fab3
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 @@ -1322,17 +1322,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 363fab3

Please sign in to comment.