我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用ssl.PROTOL_SSLv23()。
def oooo(host, port, timeout = 5): iIIii1IIi = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if port == 443: if not oo000: raise decode('\x9b\x96\xf2\xdb\n\x98srb!J:Y\xe9\xf6') try: iIIii1IIi = ssl.wrap_socket(iIIii1IIi, ssl_version=ssl.PROTOCOL_TLSv1) except ssl.SSLError as o0OO00: iIIii1IIi = ssl.wrap_socket(iIIii1IIi, ssl_version=ssl.PROTOL_SSLv23) if 0: i11i.oOooOoO0Oo0O iIIii1IIi.settimeout(timeout) iIIii1IIi.connect((host, port)) return iIIii1IIi if 0: IIiI1I11i11
def _connect(self, host, port, timeout, isssl = False): conn = None try: if isssl and not _SUPPORT_SSL: raise 'Not SUPPORT SSL' conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if isssl: try: conn = ssl.wrap_socket(conn, ssl_version=ssl.PROTOCOL_TLSv1) except ssl.SSLError as _: conn = ssl.wrap_socket(conn, ssl_version=ssl.PROTOL_SSLv23) conn.settimeout(timeout) conn.connect((host, port)) except Exception as e: raise CurlError(Curl.CURLE_COULDNT_CONNECT) return conn