汇流用rest api

confluence_rest的Python项目详细描述


通过CLI使用Atlassian合流Wiki的简单python脚本

用法

$ python confluence.py --help
usage: confluence.py [-h] -w WIKIURL -u USERNAME -p PASSWORD
                     {addpage,updatepage,copypage,listpages,removepage,getpagecontent,getpagesummary,getpagesource,getattachments,getattachment,listspaces,addspace,removespace,adduser,removeuser,deactivateuser,reactivateuser,changeuserpassword,addgroup,removegroup,listgroups,listusers,getallpages,addusertogroup,removeusergromgroup,listusergroups,pagesbylabel}
                     ...

Confluence wiki API

positional arguments:
  {addpage,updatepage,copypage,listpages,removepage,getpagecontent,getpagesummary,getpagesource,getattachments,getattachment,listspaces,addspace,removespace,adduser,removeuser,deactivateuser,reactivateuser,changeuserpassword,addgroup,removegroup,listgroups,listusers,getallpages,addusertogroup,removeusergromgroup,listusergroups,pagesbylabel}
    addpage             Add a page
    copypage            Copies a page
    updatepage          Update a page
    listpages           List pages in one or all spaces
    removepage          Remove a page
    getpagecontent      Get page content
    getpagesource       Get page source
    getpagesummary      Get page summary
    getattachments      Get a list of all attachments
    getattachment       Get a specific attachment
    listspaces          List all spaces
    addspace            Add a space
    removespace         Remove a space
    adduser             Add a user
    removeuser          Remove a user
    deactivateuser      Deactivate a user
    reactivateuser      Reactivate a user
    changeuserpassword  Change user password
    addgroup            Add a goup
    removegroup         Remove a goup
    listgroups          List all goup
    listusers           List all users
    getallpages         Save all pages to local files.
    addusertogroup      Add user to a group
    removeusergromgroup
                        Remove user from a group
    listusergroups      List groups user is in
    pagesbylabel        Pages by Label

optional arguments:
  -h, --help            show this help message and exit
  -w WIKIURL, --wikiurl WIKIURL
                        Wiki URL (only FQDN, no / and such)
  -u USERNAME, --username USERNAME
                        Login Username
  -p PASSWORD, --password PASSWORD
                        Login Password

示例

添加页面:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" addpage -f ./content.txt -n "CLI New Page" -s "RAY"
http://wiki.raymii.org/display/RAY/CLI+New+Page

删除页面:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" removepage -n "CLI New Page" -s "RAY"

更新页面:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" updatepage -f ./content.txt -n "CLI New Page" -s "RAY"
http://wiki.raymii.org/display/RAY/CLI+New+Page

获取页面内容(HTML):

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" getpagecontent -n "CLI New Page" -s "RAY"
<h1>Table of Contents</h1>
<p><ac:macro ac:name="toc" /></p>
<h1>Information</h1>

添加空间:

./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" addspace -n "New Space" -s "NS"

删除空间:

./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" removespace -s "NS"

列出所有空格:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" listspaces
NS, New Space, http://wiki.raymii.org/display/NS
ITS, IT Staff, http://wiki.raymii.org/display/ITS

添加用户:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" adduser -U "newuser" -N "New user" -E "newuser@raymii.org" -X "password"

删除用户:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" removeuser -U newuser

停用用户:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" deactivateuser -U newuser

重新激活用户:

$ ./confluence.py --wikiurl="http://wiki.raymii.org" -u "api" -p "" reactivateuser -U newuser

有关更多操作,请运行./confluence.py -h或参阅使用部分 上面。

更多信息

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
多线程在java中是否可以自动创建线程?根据标准   java什么是模型。在playframework中刷新do(1.2.4)   java数据正在三个不同的适配器中被覆盖   当使用Java驱动程序更新MongoDB的数据时,数据库id被内部对象的_id替换   java调用vkCmdDraw会使用LWJGL导致本机崩溃   for循环中的java增量给出了不同的答案   java中用于密码验证的正则表达式,允许某些特殊字符,但不是必需的   安卓 Java ExecutorService任务/可调用未取消/中断   java Jmeter远程测试:。RemoteJMeterEngineImpl_存根(无安全管理器:RMI类加载程序已禁用)   java在drools drl中使用POJO的hashmap   带hibernate的java BigQuery   JAVA网StAX解析XML文件时出现异常   java ODK聚合未启动。多重例外   使用序列图进行java编码   moduleinfo中的java Javadoc注释   java Mockito when()。thenReturn()在返回空列表时返回Null   朱尼特和詹金斯组织。朱尼特。contrib。JAVAlang.system。内部的CheckExitCalled:尝试以状态0退出   java如何创建用户定义的JLabel,JTextField?