summaryrefslogtreecommitdiff
path: root/examples/set_avatar.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-19 17:47:26 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-19 17:47:26 +0100
commit9f6fa6513946e78de6e77a7e924fedc84c89ad25 (patch)
tree079a4f43a51cb7b4242c87aaa41810a30be11644 /examples/set_avatar.py
parent35fa33e3c232377acf77805d858a4efec54180ca (diff)
downloadslixmpp-9f6fa6513946e78de6e77a7e924fedc84c89ad25.tar.gz
slixmpp-9f6fa6513946e78de6e77a7e924fedc84c89ad25.tar.bz2
slixmpp-9f6fa6513946e78de6e77a7e924fedc84c89ad25.tar.xz
slixmpp-9f6fa6513946e78de6e77a7e924fedc84c89ad25.zip
examples, tests: Replace all @asyncio.coroutines with proper async functions.
Diffstat (limited to 'examples/set_avatar.py')
-rwxr-xr-xexamples/set_avatar.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/set_avatar.py b/examples/set_avatar.py
index f9641b1e..26a393c7 100755
--- a/examples/set_avatar.py
+++ b/examples/set_avatar.py
@@ -33,8 +33,7 @@ class AvatarSetter(slixmpp.ClientXMPP):
self.filepath = filepath
- @asyncio.coroutine
- def start(self, event):
+ async def start(self, event):
"""
Process the session_start event.
@@ -68,20 +67,20 @@ class AvatarSetter(slixmpp.ClientXMPP):
used_xep84 = False
print('Publish XEP-0084 avatar data')
- result = yield from self['xep_0084'].publish_avatar(avatar)
+ result = await self['xep_0084'].publish_avatar(avatar)
if isinstance(result, XMPPError):
print('Could not publish XEP-0084 avatar')
else:
used_xep84 = True
print('Update vCard with avatar')
- result = yield from self['xep_0153'].set_avatar(avatar=avatar, mtype=avatar_type)
+ result = await self['xep_0153'].set_avatar(avatar=avatar, mtype=avatar_type)
if isinstance(result, XMPPError):
print('Could not set vCard avatar')
if used_xep84:
print('Advertise XEP-0084 avatar metadata')
- result = yield from self['xep_0084'].publish_avatar_metadata([
+ result = await self['xep_0084'].publish_avatar_metadata([
{'id': avatar_id,
'type': avatar_type,
'bytes': avatar_bytes}