首页 > Windows开发 > 详细

通过Confulence API统计用户文档贡献量

时间:2019-10-23 19:59:12      阅读:384      评论:0      收藏:0      [点我收藏+]

Confulence提供了非常清晰的RESTful API,直接使用API比confluence_python_cli这个库更方便。

参考文档:https://developer.atlassian.com/server/confluence/confluence-server-rest-api/
CQL参考:https://developer.atlassian.com/server/confluence/cql-field-reference/#created

比如统计某个用户某段时间的文档贡献量:

import requests
from datetime import datetime

def get_confluence_doc_num(user, start_time, end_time=None, page_type='page'):
    """获取某人Confulence文档数量"""
    if end_time is None:
        end_time = datetime.now().strftime('%Y-%m-%d')
    url = f'http://confluence.siku.cn/rest/api/content/search?cql=(creator={user} and type={page_type} '         f'and created >= {start_time} and created < {end_time})&limit=1000'
    res = requests.get(url, auth=('用户名', '密码'))
    return res.json().get('size')

通过Confulence API统计用户文档贡献量

原文:https://www.cnblogs.com/superhin/p/11728411.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!