summaryrefslogtreecommitdiff
path: root/examples/http_upload.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/http_upload.py')
-rwxr-xr-xexamples/http_upload.py5
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)