trying to wrap xmlrpclib into classes

Steven Noels stevenn at
Tue Jan 21 10:43:54 CET 2003

Hi there,

<warning>These are my first steps into Python programming, pardon my 

I'm trying to create a little application which uses xmlrpclib to 
retrieve information from some server. After some Googling, I succeeded 
in accessing my server and I'm pretty confident I will get where I want 
with conventional procedural/functional programming. Since part of my 
venture in learning Python is to use OO, I start from scratch this 
morning, trying to wrap stuff into objects. And I'm failing fast :(

This is where I got so far:

import xmlrpclib, time, strptime
from UrllibTransport import UrllibTransport

class Server:
     def __init__(self, URL):
         self.server_url = URL
         self.server = xmlrpclib.Server(self.server_url, 

class Page:
     def __init__(self, name, URL): = name
         self.server = Server(URL)
     def getInfo(self):
         self.result =

page = Page('Main', '')
pageinfo = page.getInfo()

I have a Server class, which should represent an XMLRPC 'connection', 
and I also defined a Page class, which should represent a logical 
structure available across that connection.

(API documented here:

Instantiating my page goes well, but trying to access a method like 
getInfo, which should invoke through my 
server object does not work, for obvious reasons:

     self.result =
AttributeError: Server instance has no attribute 'wiki'

'Somehow', I want this Page object to forward the method invocation to 
my Server object, but I'm stuck on the _how_. Should I let my Server 
class inherit from the xmlrpclib.Server class? My Page class too?

I will try into that direction, but any tips and pointers would be 
appreciated. Also, sorry if this isn't the clueless newbie user's list.


Steven Noels                  
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at  
stevenn at                stevenn at

More information about the Python-list mailing list