class ConfluenceClient(object): def __init__(self, url, username, password): self.confluence = Confluence(url, username, password) """ Get a array of all page titles (including children) in a space. """ def get_page_names(self, space_key): has_next = True page_names = [] start = 0 limit = 25 while has_next is True: pages = self.confluence.get_pages(space_key, start, limit).json() results = pages['results'] for page in results: page_names.append(page['title']) if 'next' in pages['_links']: start = pages['start'] + pages['limit'] else: has_next = False return page_names """ Get count of all pages in a space """ def get_page_count(self, space_key): return len(self.get_page_names(space_key)) """ Create an empty page in the give Confluence space """ def create_empty_page(self, space_key, title, parent_page_id=None): if parent_page_id is not None: ancestors = [{ 'id': parent_page_id }] else: ancestors = None return self.confluence.create_page(space_key, title, ancestors, '') """ Write content to file """ def write_to_file(filepath, content): outfile = open(filepath, 'w') outfile.write(content) outfile.close()
def main(list_id, space_id): trel = Trello() conf = Confluence() page = trel.format_page(list_id) # html pageData conf.create_page(page, space_key) # creates page print('\n\n\n page.py script is done!!! \n\n\n') # TEST
# main script to make Conf page from Trello list from trello import Trello from confluence import Confluence if __name__ == "__main__": t = Trello() conf = Confluence() conf.create_page(t.mmain()) print('main sript done!')