crossbario / autobahn-python

WebSocket and WAMP in Python for Twisted and asyncio
https://crossbar.io/autobahn
MIT License
2.48k stars 768 forks source link

fix imports when no TLS is available (move extract_peer_certificate) … #1560

Closed oberstet closed 2 years ago

oberstet commented 2 years ago

…- fixes #1559

oberstet commented 2 years ago

tested with TLS and non-TLS tests and Crossbar.io: Bildschirmfoto von 2022-05-04 16-30-46

oberstet commented 2 years ago

ok, and https://github.com/crossbario/autobahn-python/issues/1559 is indeed fixed:

(base) oberstet@intel-nuci7:~$ ~/cpy39/bin/python3 -m venv ~/cpy39_11
(base) oberstet@intel-nuci7:~$ source ~/cpy39_11/bin/activate
(cpy39_11) (base) oberstet@intel-nuci7:~$ pip install autobahn
Processing ./.cache/pip/wheels/02/21/5e/29eedffff2e7b5ff4aa269380e46dff334076ed34f564dd36f/autobahn-22.4.1-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./cpy39_11/lib/python3.9/site-packages (from autobahn) (49.2.1)
Collecting txaio>=21.2.1
  Using cached txaio-22.2.1-py2.py3-none-any.whl (30 kB)
Collecting hyperlink>=21.0.0
  Using cached hyperlink-21.0.0-py2.py3-none-any.whl (74 kB)
Collecting cryptography>=3.4.6
  Downloading cryptography-37.0.2-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB)
     |████████████████████████████████| 4.1 MB 4.7 MB/s 
Collecting idna>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (444 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: txaio, idna, hyperlink, pycparser, cffi, cryptography, autobahn
Successfully installed autobahn-22.4.1 cffi-1.15.0 cryptography-37.0.2 hyperlink-21.0.0 idna-3.3 pycparser-2.21 txaio-22.2.1
WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the '/home/oberstet/cpy39_11/bin/python3 -m pip install --upgrade pip' command.
(cpy39_11) (base) oberstet@intel-nuci7:~$ python -c "from autobahn.twisted import util"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/oberstet/cpy39_11/lib/python3.9/site-packages/autobahn/twisted/__init__.py", line 36, in <module>
    from autobahn.twisted.util import sleep
  File "/home/oberstet/cpy39_11/lib/python3.9/site-packages/autobahn/twisted/util.py", line 32, in <module>
    from twisted.internet.defer import Deferred
ModuleNotFoundError: No module named 'twisted.internet'
(cpy39_11) (base) oberstet@intel-nuci7:~$ pip install twisted
Collecting twisted
  Using cached Twisted-22.4.0-py3-none-any.whl (3.1 MB)
Collecting Automat>=0.8.0
  Using cached Automat-20.2.0-py2.py3-none-any.whl (31 kB)
Collecting attrs>=19.2.0
  Using cached attrs-21.4.0-py2.py3-none-any.whl (60 kB)
Collecting typing-extensions>=3.6.5
  Using cached typing_extensions-4.2.0-py3-none-any.whl (24 kB)
Collecting incremental>=21.3.0
  Using cached incremental-21.3.0-py2.py3-none-any.whl (15 kB)
Collecting constantly>=15.1
  Using cached constantly-15.1.0-py2.py3-none-any.whl (7.9 kB)
Collecting zope.interface>=4.4.2
  Using cached zope.interface-5.4.0-cp39-cp39-manylinux2010_x86_64.whl (255 kB)
Requirement already satisfied: hyperlink>=17.1.1 in ./cpy39_11/lib/python3.9/site-packages (from twisted) (21.0.0)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: setuptools in ./cpy39_11/lib/python3.9/site-packages (from zope.interface>=4.4.2->twisted) (49.2.1)
Requirement already satisfied: idna>=2.5 in ./cpy39_11/lib/python3.9/site-packages (from hyperlink>=17.1.1->twisted) (3.3)
Installing collected packages: six, attrs, Automat, typing-extensions, incremental, constantly, zope.interface, twisted
Successfully installed Automat-20.2.0 attrs-21.4.0 constantly-15.1.0 incremental-21.3.0 six-1.16.0 twisted-22.4.0 typing-extensions-4.2.0 zope.interface-5.4.0
WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the '/home/oberstet/cpy39_11/bin/python3 -m pip install --upgrade pip' command.
(cpy39_11) (base) oberstet@intel-nuci7:~$ python -c "from autobahn.twisted import util"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/oberstet/cpy39_11/lib/python3.9/site-packages/autobahn/twisted/__init__.py", line 36, in <module>
    from autobahn.twisted.util import sleep
  File "/home/oberstet/cpy39_11/lib/python3.9/site-packages/autobahn/twisted/util.py", line 192, in <module>
    def extract_peer_certificate(transport: TLSMemoryBIOProtocol) -> Optional[Dict[str, Any]]:
NameError: name 'TLSMemoryBIOProtocol' is not defined
(cpy39_11) (base) oberstet@intel-nuci7:~$ cd scm/crossbario/autobahn-python/
(cpy39_11) (base) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python$ python -c "from autobahn.twisted import util"
(cpy39_11) (base) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python$ git log -1
commit 37a4d5fc72b810aab728e9a0c14964e64da1dd1c (HEAD -> fix-1559, origin/fix-1559)
Author: Tobias Oberstein <tobias.oberstein@crossbario.com>
Date:   Wed May 4 16:31:37 2022 +0200

    update changelog; bump version for hot fix
(cpy39_11) (base) oberstet@intel-nuci7:~/scm/crossbario/autobahn-python$