我创建OSX上一个很简单的例子与Python 2.6,但我不断收到:SSL包装插座:AttributeError的: '模块' 对象有没有属性 'wrap_socket'
Traceback (most recent call last):
File "ssl.py", line 1, in <module>
import socket, ssl
File "/Users/Dennis/ssl.py", line 5, in <module>
sslSocket = ssl.wrap_socket(s)
AttributeError: 'module' object has no attribute 'wrap_socket'
代码:
import socket, ssl
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('irc.freenode.net', 7000))
sslSocket = ssl.wrap_socket(s)
print repr(sslSocket.server())
print repr(sslSocket.issuer())
sslSocket.write('Hello secure socket\n')
s.close()
我在做什么非常错误?
谢谢!
丹尼斯
谢谢!这有帮助!现在我只需要修复print repr(sslSocket.server()) AttributeError:'SSLSocket'对象没有属性'server' – FLX 2011-01-27 15:40:54
@FLX:很高兴帮助:)关于你的新问题你检查了文档http:// docs.python.org/library/ssl.html#sslsocket-objects在类“SSLSocket”中没有方法`server()`? – mouad 2011-01-27 15:52:20