diff --git a/requirements.txt b/requirements.txt index 900e2c36..92e5691d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,8 @@ argo-ams-library certifi<2020.4.5.2 # Used by AMS (via requests), 2020.4.5.2 dropped support for Python 2 -pyopenssl<=21.0.0 # 22.0.0 dropped support for Python 2 -cryptography==3.3.0 # Crypto dropped support for Python 2 after 3.3. They're now on 41.X... +pyopenssl >=19.1.0, <=21.0.0 # 22.0.0 dropped support for Python 2 +cryptography==3.3.2 # Crypto dropped support for Python 2 after 3.3 stomp.py<5.0.0 python-daemon<=2.3.0 # 2.3.1 dropped support for Python 2 python-ldap<3.4.0 # python-ldap-3.4.0 dropped support for Python 2 diff --git a/setup.py b/setup.py index a495ca0c..c33e93c9 100644 --- a/setup.py +++ b/setup.py @@ -51,11 +51,11 @@ def main(): download_url='https://github.com/apel/ssm/releases', license='Apache License, Version 2.0', install_requires=[ - 'cryptography==3.3.0', + 'cryptography==3.3.2', 'stomp.py<5.0.0', 'python-ldap<3.4.0', 'setuptools', - 'pyopenssl<=21.0.0', + 'pyopenssl >=19.1.0, <=21.0.0', ], extras_require={ 'AMS': ['argo-ams-library', 'certifi<2020.4.5.2', ], diff --git a/ssm/ssm2.py b/ssm/ssm2.py index 9cbc28e2..b7dc495d 100644 --- a/ssm/ssm2.py +++ b/ssm/ssm2.py @@ -318,6 +318,9 @@ def _handle_msg(self, text): def _save_msg_to_queue(self, body, empaid): """Extract message contents and add to the accept or reject queue.""" + if isinstance(body, bytes): + body = body.decode('ascii') + extracted_msg, signer, err_msg = self._handle_msg(body) try: # If the message is empty or the error message is not empty @@ -332,7 +335,6 @@ def _save_msg_to_queue(self, body, empaid): body = extracted_msg log.warning("Message rejected: %s", err_msg) - name = self._rejectq.add({'body': body, 'signer': signer, 'empaid': empaid, @@ -479,6 +481,8 @@ def send_all(self): continue text = self._outq.get(msgid) + if isinstance(text, bytes): + text = text.decode('ascii') if self._protocol == Ssm2.STOMP_MESSAGING: # Then we are sending to a STOMP message broker.