Tuesday, July 15, 2014

Confluence Development

http://stackoverflow.com/questions/14585365/how-do-i-create-text-file-for-confluence-and-then-import-it-as-a-confluence-wiki 
 
import sys
import xmlrpc.client
import os
import re

# Connects to confluence server with username and password
site_URL = "YOUR_URL"
server = xmlrpc.client.ServerProxy(site_URL + "/rpc/xmlrpc")

username = "YOUR_USERNAME"
pwd = "YOUR_PASSWORD" 
token = server.confluence2.login(username, pwd)

# The space you want to add a page to
spacekey = "YOUR_SPACENAME"

# Retrives text from a file
f = open('FileName.txt', 'r')
content = f.read()
f.close()

# Creates a new page to insert in the new space from text file content
newpage = {"title":"NEW_PAGENAME", "space":spacekey, "content":content}
server.confluence2.storePage(token, newpage)

server.confluence2.logout(token)

No comments:

Post a Comment