微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

属性错误:pyopenssl 20.0.1 中的 __enter__

如何解决属性错误:pyopenssl 20.0.1 中的 __enter__

在 pyopenssl 中使用 websocket create_connection() api 调用创建安全的 websocket 连接 (wss) 时 - openssl/ssl.py (20.0.1),AttributeError: enter错误被抛出。

错误指向“在 SSL.py 文件的发送方法中有可用的语句”,而在 19.1.0 pyopenssl 版本中,没有观察到错误

with _from_buffer(buf) as data:
            # check len(buf) instead of len(data) for testability
            if len(buf) > 2147483647:
                raise ValueError(
                    "Cannot send more than 2**31-1 bytes at once."
                )

            result = _lib.SSL_write(self._ssl,data,len(data))
            self._raise_ssl_error(self._ssl,result)

            return result

解决方法

试试pip install pyOpenSSL==19.1.0

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。