Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

updating, adding new pages to confluence remotely, using python

0 views
Skip to first unread message

pescadero10

unread,
Jul 6, 2009, 1:30:41 PM7/6/09
to
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

Terry Reedy

unread,
Jul 6, 2009, 4:27:25 PM7/6/09
to pytho...@python.org

You neglected to specify Python version.

As near as I can tell from 2.x docs, xmlrpclib has ServerProxy class but
no Server class. Whoops, just saw "Server is retained as an alias for
ServerProxy for backwards compatibility. New code should use
ServerProxy". Good idea -- calling a client 'server' is confusing.

Do you have access to logs on remote machine to see what was received?
Or to a sysadmin?

tjr

0 new messages