updating, adding new pages to confluence remotely, using python

pescadero10 pescadero10 at gmail.com
Mon Jul 6 13:30:41 EDT 2009


Hello,

I am new to python and have been trying to figure out how to remotely
add new pages to my confluence
wiki space. I'm running my python script from a linux rhel4 machine
and using confluence version 2.10. As a test I tried to read from
stdin and write a page but it fails- that is, the script runs without
errors but nothing is added.  Does anyone have an example of how this
is done?  Here is my script:

--- begin script -----------
#!/usr/local/bin/python
#
# Reads from standard input, dumps it onto a Confluence page
# You'll need to modify the URL/username/password/spacekey/page title
# below, because I'm too lazy to bother with argv.

import sys
from xmlrpclib import Server

# Read the text of the page from standard input
content = sys.stdin.read()

s = Server("http://confluence.slac.stanford.edu/display/GO/Home")
token = s.confluence1.login("chee", "******")
page = s.confluence1.getPage(token, "SPACEKEY", "TEST Python-2-
Confluence")
page["content"] = content
s.confluence1.storePage(token, page)

newpagedata = {"title":"New Page","content":"new
content","space":"spaceKey"}
newpage = s.confluence1.storePage(token, newpagedata);
------------ end script ------------------------

Any help would be greatly appreciated.

thanks, Pescadero10



More information about the Python-list mailing list