Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ def get_child_pages(self, page_id):
"""
return self.get_page_child_by_type(page_id=page_id, type="page")

def get_page_id(self, space, title):
def get_page_id(self, space, title, type='page'):
"""
Provide content id from search result by title and space
:param space: SPACE key
:param title: title
:param type: type of content: Page or Blogpost. Defaults to page
:return:
"""
return (self.get_page_by_title(space, title) or {}).get("id")
return (self.get_page_by_title(space, title, type=type) or {}).get("id")

def get_parent_content_id(self, page_id):
"""
Expand Down Expand Up @@ -269,7 +270,7 @@ def get_pages_by_title(self, space, title, start=0, limit=200, expand=None):
"""
return self.get_page_by_title(space, title, start, limit, expand)

def get_page_by_title(self, space, title, start=0, limit=1, expand=None):
def get_page_by_title(self, space, title, start=0, limit=1, expand=None, type='page'):
"""
Returns the first page on a piece of Content.
:param space: Space key
Expand All @@ -278,12 +279,13 @@ def get_page_by_title(self, space, title, start=0, limit=1, expand=None):
:param limit: OPTIONAL: The limit of the number of labels to return, this may be restricted by
fixed system limits. Default: 1.
:param expand: OPTIONAL: expand e.g. history
:param type: OPTIONAL: Type of content: Page or Blogpost. Defaults to page
:return: The JSON data returned from searched results the content endpoint, or the results of the
callback. Will raise requests.HTTPError on bad input, potentially.
If it has IndexError then return the None.
"""
url = "rest/api/content"
params = {}
params = {"type": type}
if start is not None:
params["start"] = int(start)
if limit is not None:
Expand Down