Ejemplo de uso de XMLRPC para Confluence en Python


#!/usr/bin/python
# M.C <mau.cendon@gmail.com>
import sys, string, xmlrpclib
server = xmlrpclib.ServerProxy( 'https://mi-url.atlassian.net/wiki/rpc/xmlrpc' );
token = server.confluence2.login('admin', 'password');
pageId = sys.argv[1];
page = server.confluence2.getPage( token, pageId );
pageDescendents = server.confluence2.getDescendents( token, pageId );
print 'PAGINA: ' + page['title'];
print '';
print 'PAGINAS HIJAS: ';
for child in pageDescendents:
 print child['title'];
  
print '';
print '';
print '';
print 'HISTORIAL DE PAGINAS:';
for child in pageDescendents:
 history = server.confluence2.getPageHistory( token, child['id'] );
 if (history == None):
 print 'La pagina ' + child['title'] + ' no tiene historial';
 else:
 print child['title'];
 for historyPage in history:
 page = server.confluence2.getPage( token, historyPage['id']);
 print ' VERSION: ' + historyPage['version'] + ' TITULO: ' + page['title'] + ' URL: ' + page['url'];
 print '';
 print '';
 print '';

Comentarios

Entradas populares