如何使用 Python 将 Confluence 页面连同内容从一个空间移动到另一个空间? [英] How to move Confluence pages along with the contents from one space to another using Python?

查看:171
本文介绍了如何使用 Python 将 Confluence 页面连同内容从一个空间移动到另一个空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个基于 atlassian-python-api 模块的 Python 脚本,该脚本将从一个空间复制空间,并使用以下命令在托管在不同服务器上的另一个空间中创建它们:

I'm trying to write a Python script based on the atlassian-python-api module which will copy the spaces from one space and the create them in another space hosted in a different server using the following commands:

pages = sourceConfluence.get_all_pages_from_space(space = source_Space, start=0, limit=100, status=None, expand='body.storage.content', content_type='page')
for i in pages:
    status = destConfluence.create_page(space = dest_Space, title=i['title'], body=i['body'], parent_id=None, type='page', representation='storage')

这在包含 pdf 或图像等内容的页面进入之前正常工作.在这种情况下,它会为新生成的页面中的内容创建无效链接.

This works fine until pages with content like pdf or images comes in. In that case, it creates a invalid link for the contents in the newly generated pages.

如何直接使用包装器或 Confluence REST API 移动内容完整的页面?

How can I move the pages with the content intact using the wrapper or Confluence REST API directly?

推荐答案

根据我的理解,目前使用 Python 还没有以编程方式执行此操作的正确方法.

As per my understanding, there’s no proper way to do this programmatically as of now using Python.

实现这一目标的唯一方法如下:

The only ways we can achieve this are as follows:

  1. 复制 从编辑模式手动一页一页地粘贴页面.
  2. XML 导出 &通过将 XML 文件放入 JIRA 服务器来导入空间.
  3. 使用支持此功能的 Bobswift CLI 工具.

这篇关于如何使用 Python 将 Confluence 页面连同内容从一个空间移动到另一个空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆