JabberCard/jabbercard/xmpp/xep_0054.py
Schimon Jehudah, Adv. 5e495579c2 Add file PyProject;
Support display of a single pubsub node item;
Update document README;
Modularize code;
2024-11-17 17:30:38 +02:00

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