Exemplo n.º 1
0
    confluence = Confluence(
        url='https://hub.internal.couchbase.com/confluence',
        username=params.userid,
        password=params.password)

    #filter out pages are not necessary to be backed up
    #7242630 is the page ID of "archived".
    #"Production Build Status" does not return, results in socket timeout
    cql = 'space.key=' + '"' + spacekey + '"' + ' and type="page" \
        and title !~ "Build Team Status" and title !~ "buildbot" \
        and title !~ "Production Build Status" and ancestor != 7242630'

    response = confluence.cql(cql, limit=page_limit, expand='ancestors')
    if response.get('totalSize') > page_limit:
        #If total page number is higher than the set limit,
        #rerun the cql with higher limit
        response = confluence.cql(cql,
                                  limit=response.get('totalSize'),
                                  expand='ancestors')

    for page in response.get('results'):
        print("Getting content of ", page['title'].replace('/', ''))
        response = confluence.get_page_as_pdf(page['content']['id'])

        #Remove "/" if it exist in page title before saving the file
        #else it will cause issue during page creation
        save_file(content=response, title=page['title'].replace('/', ''))

    create_tar(tar_name)
    s3_upload_file(tar_name, bucket_name, object_name=None)
# coding=utf-8
from atlassian import Confluence
"""This example shows how to export pages """

confluence = Confluence(url='http://localhost:8090',
                        username='******',
                        password='******')


def save_file(content, title):
    file_pdf = open(title + ".pdf", 'w')
    file_pdf.write(content)
    file_pdf.close()
    print("Completed")


if __name__ == '__main__':
    label = "super-important"
    pages = confluence.get_all_pages_by_label(label=label, start=0, limit=10)
    for page in pages:
        response = confluence.get_page_as_pdf(page[id])
        save_file(content=response, title=page['title'])
Exemplo n.º 3
0
# coding=utf-8
from atlassian import Confluence
"""This example shows how to export pages """

confluence = Confluence(url="http://localhost:8090",
                        username="******",
                        password="******")


def save_file(content, title):
    file_pdf = open(title + ".pdf", "w")
    file_pdf.write(content)
    file_pdf.close()
    print("Completed")


if __name__ == "__main__":
    label = "super-important"
    pages = confluence.get_all_pages_by_label(label=label, start=0, limit=10)
    for page in pages:
        response = confluence.get_page_as_pdf(page["id"])
        save_file(content=response, title=page["title"])