From d4d542b7411c9f2d099d17bae0acfe327318442c Mon Sep 17 00:00:00 2001 From: Florian Klien Date: Sat, 27 Oct 2018 21:38:50 +0200 Subject: fixing uncaught async exceptions due to missing await fixes uncaught exceptions in the event loop. passing timeout and timeout_callback through. --- examples/http_upload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'examples') 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) -- cgit v1.2.3