pescadero10 wrote:

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.

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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to