summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml6
-rwxr-xr-xexamples/http_upload.py18
-rwxr-xr-xsetup.py8
3 files changed, 26 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 69bd7b7a..ebcc24eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,7 +20,7 @@ test:
script:
- apt update
- apt install -y python3 python3-pip cython3 gpg
- - pip3 install emoji aiohttp
+ - pip3 install emoji aiohttp cryptography
- ./run_tests.py
test-3.10:
@@ -31,7 +31,7 @@ test-3.10:
script:
- apt update
- apt install -y python3 python3-pip cython3 gpg
- - pip3 install emoji aiohttp
+ - pip3 install emoji aiohttp cryptography
- ./run_tests.py
test-3.11:
@@ -43,7 +43,7 @@ test-3.11:
script:
- apt update
- apt install -y python3 python3-pip cython3 gpg
- - pip3 install emoji aiohttp
+ - pip3 install emoji aiohttp cryptography
- ./run_tests.py
test_integration:
diff --git a/examples/http_upload.py b/examples/http_upload.py
index 7f1c44bc..b62c736e 100755
--- a/examples/http_upload.py
+++ b/examples/http_upload.py
@@ -48,7 +48,15 @@ class HttpUpload(slixmpp.ClientXMPP):
log.info('Uploading file %s...', self.filename)
try:
upload_file = self['xep_0363'].upload_file
- if self.encrypted:
+ if self.encrypted and not self['xep_0454']:
+ print(
+ 'The xep_0454 module isn\'t available. '
+ 'Ensure you have \'cryptography\' '
+ 'from extras_require installed.',
+ file=sys.stderr,
+ )
+ return
+ elif self.encrypted:
upload_file = self['xep_0454'].upload_file
url = await upload_file(
self.filename, domain=self.domain, timeout=10,
@@ -135,7 +143,13 @@ if __name__ == '__main__':
xmpp.register_plugin('xep_0071')
xmpp.register_plugin('xep_0128')
xmpp.register_plugin('xep_0363')
- xmpp.register_plugin('xep_0454')
+ try:
+ xmpp.register_plugin('xep_0454')
+ except slixmpp.plugins.base.PluginNotFound:
+ log.error(
+ 'Could not load xep_0454. '
+ 'Ensure you have \'cryptography\' from extras_require installed.'
+ )
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
diff --git a/setup.py b/setup.py
index bcbcdf56..4830efcc 100755
--- a/setup.py
+++ b/setup.py
@@ -86,10 +86,16 @@ setup(
package_data={'slixmpp': ['py.typed']},
packages=packages,
ext_modules=ext_modules,
- install_requires=['aiodns>=1.0', 'pyasn1', 'pyasn1_modules', 'typing_extensions; python_version < "3.8.0"'],
+ install_requires=[
+ 'aiodns>=1.0',
+ 'pyasn1',
+ 'pyasn1_modules',
+ 'typing_extensions; python_version < "3.8.0"',
+ ],
extras_require={
'XEP-0363': ['aiohttp'],
'XEP-0444 compliance': ['emoji'],
+ 'XEP-0454': ['cryptography'],
'Safer XML parsing': ['defusedxml'],
},
classifiers=CLASSIFIERS,