summaryrefslogtreecommitdiff
path: root/examples/set_avatar.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/set_avatar.py')
-rwxr-xr-xexamples/set_avatar.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/set_avatar.py b/examples/set_avatar.py
index f9641b1e..6579b2e7 100755
--- a/examples/set_avatar.py
+++ b/examples/set_avatar.py
@@ -18,7 +18,6 @@ from argparse import ArgumentParser
import slixmpp
from slixmpp.exceptions import XMPPError
-from slixmpp import asyncio
class AvatarSetter(slixmpp.ClientXMPP):
@@ -33,8 +32,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 +66,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}