[horde] Horde RPC API (XML-RPC) possibilities

Attila Nagy bra at fsn.hu
Wed Aug 15 07:26:19 UTC 2012


On 08/13/12 18:28, Michael J Rubinsky wrote:
>
> Quoting Ralf Lang <lang at b1-systems.de>:
>
>> Am 13.08.2012 17:05, schrieb Attila Nagy:
>>> Hi,
>>>
>>> The Horde wiki (http://wiki.horde.org/Project/HordeImapLib)
>>> proudly advertises the technical excellence of Horde_Imap_Client,
>>> which sounds really good. I wonder, will it be possible to use it
>>> from the RPC API with JSON and XML-RPC? Or is this possible now? (I
>>> couldn't figure out how, apart from the few exposed functions,
>>> which are not enough for complete mail-related operations) Other
>>> modules have a broader spectrum of method-availability, but IMP
>>> seems to lack these features (judging from the documentation:
>>> http://dev.horde.org/api/imp/).
>>>
>>> With a nearly complete API coverage, Horde could be the basis for
>>> other services (for example rapid interface development for
>>> existing systems), by doing the heavy lifting itself (handling
>>> e-mails/IMAP, contacts etc).
>>>
>>> Thanks,
>>
>> Can you list which api methods you are missing?
>
> IMP also exposes the imap client object directly. So, depending on 
> exactly what you want to do, you can fetch the already authenticated 
> imap connection and use the client object directly to do what you need.
Over XML-RPC?
Could you please send an example?

Calling imapOb itself gives:
 >>> px.mail.imapOb()
{'': 'Horde_Imap_Client_Utils', 'cache': '', 'cacheFields': {'11': 
'HICdate', '10': 'HICflags', '12': 'HICsize', '1': 'HICstruct', '9': 
'HICenv', '8': 'HIChdrs'}, 'changed': True}
But for a second call:
 >>> px.mail.imapOb()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 1224, in __call__
     return self.__send(self.__name, args)
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 1578, in __request
     verbose=self.__verbose
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 1264, in request
     return self.single_request(host, handler, request_body, verbose)
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 1297, in 
single_request
     return self.parse_response(response)
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 1467, in 
parse_response
     p.feed(data)
   File "/usr/local/lib/python2.7/xmlrpclib.py", line 557, in feed
     self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: reference to invalid character number: 
line 450, column 22

It seems I can get a result only if I call something other before it, 
calling more than once gives the above error.

Calling a:
 >>> px.contacts.getAllAttributeValues('email',['ID'])
{'ID:K': {'name': 'xy z', 'email': 'x at z.com'}}
and re-issuing imapOb gives the first result, then one more call gives 
the error.

BTW, I can't see how something like mail.imapOb.getNamespace (just an 
example) would work...


More information about the horde mailing list