MCPcopy Index your code
hub / github.com/python/cpython / connect

Method connect

Lib/http/client.py:1024–1037  ·  view source on GitHub ↗

Connect to the host and port specified in __init__.

(self)

Source from the content-addressed store, hash-verified

1022 )
1023
1024 def connect(self):
1025 """Connect to the host and port specified in __init__."""
1026 sys.audit("http.client.connect", self, self.host, self.port)
1027 self.sock = self._create_connection(
1028 (self.host,self.port), self.timeout, self.source_address)
1029 # Might fail in OSs that don't implement TCP_NODELAY
1030 try:
1031 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
1032 except OSError as e:
1033 if e.errno != errno.ENOPROTOOPT:
1034 raise
1035
1036 if self._tunnel_host:
1037 self._tunnel()
1038
1039 def close(self):
1040 """Close the connection to the HTTP server."""

Callers 10

sendMethod · 0.95
testTimeoutAttributeMethod · 0.95
connectMethod · 0.45
mainFunction · 0.45
makeSocketMethod · 0.45
_connect_unixsocketMethod · 0.45
createSocketMethod · 0.45
__init__Method · 0.45
server_activateMethod · 0.45
initMethod · 0.45

Calls 3

_tunnelMethod · 0.95
_create_connectionMethod · 0.80
setsockoptMethod · 0.45

Tested by 1

testTimeoutAttributeMethod · 0.76