5e495579c2
Support display of a single pubsub node item; Update document README; Modularize code;
29 lines
851 B
Python
29 lines
851 B
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from asyncio import TimeoutError
|
|
from slixmpp.exceptions import IqError, IqTimeout, PresenceError
|
|
|
|
class XmppXep0054:
|
|
|
|
async def get_vcard_data(self, jid_bare):
|
|
try:
|
|
error = False
|
|
condition = text = ''
|
|
iq = await self['xep_0054'].get_vcard(jid_bare)
|
|
except (IqError, IqTimeout) as e:
|
|
error = True
|
|
condition = e.iq['error']['condition']
|
|
text = e.iq['error']['text']
|
|
if not text:
|
|
if condition:
|
|
text = 'Could not retrieve vCard'
|
|
else:
|
|
text = 'Unknown Error'
|
|
iq = ''
|
|
result = {
|
|
'error' : error,
|
|
'condition' : condition,
|
|
'text' : text,
|
|
'iq' : iq}
|
|
return result
|