diff options
author | Florian Klien <flowolf@klienux.org> | 2018-10-27 21:38:50 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-10-27 22:51:04 +0200 |
commit | d4d542b7411c9f2d099d17bae0acfe327318442c (patch) | |
tree | bba4b9b86ce0237d3f7f50cc7283b5694a85c671 /examples/http_upload.py | |
parent | 897610d819425a84a232e26f239482b66a09dd8b (diff) | |
download | slixmpp-d4d542b7411c9f2d099d17bae0acfe327318442c.tar.gz slixmpp-d4d542b7411c9f2d099d17bae0acfe327318442c.tar.bz2 slixmpp-d4d542b7411c9f2d099d17bae0acfe327318442c.tar.xz slixmpp-d4d542b7411c9f2d099d17bae0acfe327318442c.zip |
fixing uncaught async exceptions due to missing await
fixes uncaught exceptions in the event loop.
passing timeout and timeout_callback through.
Diffstat (limited to 'examples/http_upload.py')
-rwxr-xr-x | examples/http_upload.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/http_upload.py b/examples/http_upload.py index 2e5476c0..f2c292a2 100755 --- a/examples/http_upload.py +++ b/examples/http_upload.py @@ -34,7 +34,10 @@ class HttpUpload(slixmpp.ClientXMPP): async def start(self, event): log.info('Uploading file %s...', self.filename) - url = await self['xep_0363'].upload_file(self.filename) + def timeout_callback(arg): + raise TimeoutError("could not send message in time") + url = await self['xep_0363'].upload_file( + self.filename, timeout=10, timeout_callback=timeout_callback) log.info('Upload success!') log.info('Sending file to %s', self.recipient) |