Add file PyProject;

Support display of a single pubsub node item;
Update document README;
Modularize code;
This commit is contained in:
Schimon Jehudah, Adv. 2024-11-17 17:30:38 +02:00
parent 37aa7e8f40
commit 5e495579c2
32 changed files with 2431 additions and 2059 deletions

View file

@ -0,0 +1,29 @@
#!/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