python : atlassian. 错误。ApiValueError : No space or no content type, 或设置了错误的版本类型设置为内容,或状态参数不是草稿

标签 python api confluence confluence-rest-api atlassian-python-api

我正在使用 confluence API(使用 python)来更新现有的 confluence 页面,但我遇到以下错误:

atlassian.errors.ApiValueError: No space or no content type, or setup a wrong version type set to content, or status param is not draft and status content is current

奇怪的是,我之前可以更新页面 10 次,但突然抛出错误。也许我错过了什么?

任何人都可以提出缺少的内容吗?我正在使用下面的代码片段:

confluence = Confluence(url=confluence_url,username=userid,password=password)

status = confluence.update_page(page_id, title, pagecontent)

pprint(status)

最佳答案

我看到同样的错误,因为我的页面内容包含 <DC>在其中和 HTML 中 <>需要转义。

似乎是 update_page 的第三个参数需要有效的 html 字符串。

您可以使用它escape python 中的方法(如果您使用的是 python 3.4+)

from html import escape
from atlassian import Confluence


confluence = Confluence(url=confluence_url,username=userid,password=password)

status = confluence.update_page(page_id, title, escape(pagecontent))

pprint(status)

关于python : atlassian. 错误。ApiValueError : No space or no content type, 或设置了错误的版本类型设置为内容,或状态参数不是草稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70266387/

相关文章:

api - Flutter:Futurebuilder从类中获取空值

flutter - 从 api Flutter 获取数据时快照出错

javascript - 在哪里显示$.post信息?

migration - MediaWiki 到 Confluence 迁移

wiki - 如何在Confluence(Wiki)中组织空间?

python - 从 docker 中的 pipfile.lock 安装时出错

python - 将行值量化为组并计算每组的平均值

python - 使用非 ASCII 字符作为 python 字典中的键时出现 KeyError

python - 来自 pandas 数据帧的图中的分组堆积条

powershell - 使用Powershell将文件上传到Confluence