MCPcopy Index your code
hub / github.com/websocket-client/websocket-client / _ssl_socket

Function _ssl_socket

websocket/_http.py:323–347  ·  view source on GitHub ↗
(sock: socket.socket, user_sslopt: dict, hostname)

Source from the content-addressed store, hash-verified

321
322
323def _ssl_socket(sock: socket.socket, user_sslopt: dict, hostname):
324 sslopt: dict = {"cert_reqs": ssl.CERT_REQUIRED}
325 sslopt.update(user_sslopt)
326
327 cert_path = os.environ.get("WEBSOCKET_CLIENT_CA_BUNDLE")
328 if (
329 cert_path
330 and os.path.isfile(cert_path)
331 and user_sslopt.get("ca_certs", None) is None
332 ):
333 sslopt["ca_certs"] = cert_path
334 elif (
335 cert_path
336 and os.path.isdir(cert_path)
337 and user_sslopt.get("ca_cert_path", None) is None
338 ):
339 sslopt["ca_cert_path"] = cert_path
340
341 if sslopt.get("server_hostname", None):
342 hostname = sslopt["server_hostname"]
343
344 check_hostname = sslopt.get("check_hostname", True)
345 sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
346
347 return sock
348
349
350def _tunnel(sock: socket.socket, host, port: int, auth) -> socket.socket:

Calls 2

_wrap_sni_socketFunction · 0.85
getMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…