diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-08-19 17:47:26 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-08-19 17:47:26 +0100 |
commit | 9f6fa6513946e78de6e77a7e924fedc84c89ad25 (patch) | |
tree | 079a4f43a51cb7b4242c87aaa41810a30be11644 /examples/ibb_transfer | |
parent | 35fa33e3c232377acf77805d858a4efec54180ca (diff) | |
download | slixmpp-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/ibb_transfer')
-rwxr-xr-x | examples/ibb_transfer/ibb_sender.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/ibb_transfer/ibb_sender.py b/examples/ibb_transfer/ibb_sender.py index f1c0cab2..e66b6749 100755 --- a/examples/ibb_transfer/ibb_sender.py +++ b/examples/ibb_transfer/ibb_sender.py @@ -39,8 +39,7 @@ class IBBSender(slixmpp.ClientXMPP): # our roster. self.add_event_handler("session_start", self.start) - @asyncio.coroutine - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -58,13 +57,13 @@ class IBBSender(slixmpp.ClientXMPP): try: # Open the IBB stream in which to write to. - stream = yield from self['xep_0047'].open_stream(self.receiver, use_messages=self.use_messages) + stream = await self['xep_0047'].open_stream(self.receiver, use_messages=self.use_messages) # If you want to send in-memory bytes, use stream.sendall() instead. - yield from stream.sendfile(self.file, timeout=10) + await stream.sendfile(self.file, timeout=10) # And finally close the stream. - yield from stream.close(timeout=10) + await stream.close(timeout=10) except (IqError, IqTimeout): print('File transfer errored') else: |