如何通过 api 从 Confluence 页面获取文档的上次更新日期?

发布于 2025-01-14 13:12:00 字数 788 浏览 0 评论 0原文

我正在尝试使用 api 从文档的汇合中获取上次更新日期,但无法获取它。有人能指出我正确的方向吗?推荐的一种解决方案是使用 requests 库和 Beautiful Soup 并解析 html,但我希望通过 api 来完成此操作,但到目前为止还没有取得太大成功。

我正在使用这个: https://atlassian-python-api.readthedocs.io/confluence.html 还有这个: https://github.com/atlassian- api/atlassian-python-api/blob/master/atlassian/confluence.py

我在我提供的第一个链接中看到以下内容:

#Compare content and check is已经更新或没有

confluence.is_page_content_is_already_updated(page_id, body)

但是我什么想要的是获取文档上次更新的日期。该日期出现在我们的 Confluence 文档中,标题为“Last Updated”。最后更新日期出现在每个文档的前面。

I am trying to get Last Updated date from confluence for a document by using the api but was not able to get it. Can someone point me in the right direction? One solution recommended was to use requests library along with Beautiful Soup and parse the html but I am looking to get this done via an api but so far did not have much success.

I am using this:
https://atlassian-python-api.readthedocs.io/confluence.html
and this:
https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/confluence.py

I saw the following in the first link i provided:

#Compare content and check is already updated or not

confluence.is_page_content_is_already_updated(page_id, body)

But what I want is to grab the date a document was last updated. This date is present in our confluence docs and the title is “Last Updated” . This last updated date is present in front of every document.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水中月 2025-01-21 13:12:00

我发现这个问题还没有得到解答,所以这是我经过一番研究后的看法:

goOn = True
pages = list()
startAt = 0
while(goOn):
    batch = confluence.get_all_pages_from_space('<ConfluenceSpaceName>', start=startAt, limit=100, status=None, expand='title,history.lastUpdated')
    pages.extend(batch)
    startAt = len(pages)
    if (len(batch) == 0):
        goOn = False

for p in pages:
    if (debug): print('Page {}; updated: {}'.format(p['title'], p['history']['lastUpdated']['when']))

谢谢,基里尔

I see that this has not been answered, so here's my take after some research:

goOn = True
pages = list()
startAt = 0
while(goOn):
    batch = confluence.get_all_pages_from_space('<ConfluenceSpaceName>', start=startAt, limit=100, status=None, expand='title,history.lastUpdated')
    pages.extend(batch)
    startAt = len(pages)
    if (len(batch) == 0):
        goOn = False

for p in pages:
    if (debug): print('Page {}; updated: {}'.format(p['title'], p['history']['lastUpdated']['when']))

Thanks, Kirill

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文