wikiconfig

actions_excluded = multiconfig.DefaultConfig.actions_excluded[:]
actions_excluded.remove('xmlrpc')
acl_rights_before = u"AdminName:read,write,delete,revert,admin"
acl_rights_default = u"UserGroup:read,write,delete,revert All:"

Examples

put page

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 import xmlrpclib
   4 name = "TestUser"
   5 password = "secret"
   6 wikiurl = "http://localhost:8080"
   7 homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2",
   8                                  allow_none=True)
   9 auth_token = homewiki.getAuthToken(name, password)
  10 mc = xmlrpclib.MultiCall(homewiki)
  11 mc.applyAuthToken(auth_token)
  12 pagename = 'TestSeite'
  13 text = 'Dies ist eine Zeile Text'
  14 mc.putPage(pagename, text)
  15 result = mc()

get page

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 import xmlrpclib
   4 name = "TestUser"
   5 password = "secret"
   6 wikiurl = "http://localhost:8080/"
   7 homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2",
   8                                  allow_none=True)
   9 auth_token = homewiki.getAuthToken(name, password)
  10 mc = xmlrpclib.MultiCall(homewiki)
  11 mc.applyAuthToken(auth_token)
  12 pagename = u'FrontPage'
  13 mc.getPage(pagename)
  14 result = mc()
  15 success, raw = tuple(result)
  16 if success:
  17     print raw

put attachment

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 import xmlrpclib
   4 name = "TestUser"
   5 password = "secret"
   6 wikiurl = "http://localhost:8080"
   7 homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2",
   8                                          allow_none=True)
   9 mc = xmlrpclib.MultiCall(homewiki)
  10 auth_token = homewiki.getAuthToken(name, password)
  11 mc.applyAuthToken(auth_token)
  12 pagename = 'WikiSandBox'
  13 attachname = 'Beispiel.txt'
  14 text = file(attachname, 'rb').read()
  15 data = xmlrpclib.Binary(text)
  16 mc.putAttachment(pagename, attachname, data)
  17 result = mc()

get attachment

   1 #!/usr/bin/env python
   2 # -*- coding: iso-8859-1 -*-
   3 import xmlrpclib
   4 wikiurl = "http://localhost:8080"
   5 homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2",
   6                                  allow_none=True)
   7 pagename = 'TestSeite'
   8 attachname = 'Beispiel.txt'
   9 data = homewiki.getAttachment(pagename, attachname)
  10 file(attachname, 'wb').write(data.data)

MoinMoin: ReimarBauer/xmlrpc (last edited 2013-02-14 14:27:28 by ReimarBauer)