[imp] Calling IMP thru XML-RPC

Jan Schneider jan at horde.org
Fri Jun 9 02:41:39 PDT 2006


Zitat von MIlos Prudek <prudek at bvx.cz>:

> Hi,
>
> I'm trying to figure out how to call Horde from Python via XML-RPC. Knowledge
> of Python is not required to understand the following snippets.
>
> Python has a built-in library xmlrpclib that takes care of everything. The
> following test script works perfectly from Python:
>
> def getStateName(self, number):
>     import xmlrpclib
>     server_url="http://betty.userland.com"
>     server=xmlrpclib.Server(server_url)
>     return server.examples.getStateName(number)
>
> It returns Alabama for 01 and Wyoming for 50 from RPC server at userland.com.
>
> Based on that test script I wrote this snippet:
>
> def getAuth(self, user, pwd):
>     import xmlrpclib
>     server_url="http://www.orl.cz/horde/rpc.php"
>     server=xmlrpclib.Server(server_url)
>     return server.imp.authenticate(user,pwd)
>
> It returns two errors: "multiple elements on top level" and "Syntax error at
> line 2: multiple elements on top level"

These errors come from Python, no idea what they mean.

> Is my snippet OK?

No, the credential parameter takes an associative array or struct,  
with the password in the named element "password". And you probably  
need to pass the third parameter, even if you leave it empty.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the imp mailing list