test_socket_ssl.py

来自「mallet是自然语言处理、机器学习领域的一个开源项目。」· Python 代码 · 共 28 行

PY
28
字号
# Test just the SSL support in the socket module, in a moderately bogus way.import test_support# Optionally test SSL support.  This currently requires the 'network' resource# as given on the regrtest command line.  If not available, nothing after this# line will be executed.test_support.requires('network')import socketif not hasattr(socket, "ssl"):    raise test_support.TestSkipped("socket module has no ssl support")import urllibsocket.RAND_status()try:    socket.RAND_egd(1)except TypeError:    passelse:    print "didn't raise TypeError"socket.RAND_add("this is a random string", 75.0)f = urllib.urlopen('https://sf.net')buf = f.read()f.close()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?