exactonline/http.py
def connect(self):
        "Connect to a host on a given (SSL) port."
        sock = socket.create_connection((self.host, self.port),
                                        self.timeout, self.source_address)
        if self._tunnel_host:
            self.sock = sock
            self._tunnel()

        # Python 2.7.9+
        if create_default_context:
            # Newer python will use the "right" cacert file automatically. So
            # the default of None can safely be passed along.
            ctx = create_default_context(cafile=self.cacert_file)
            sock = ctx.wrap_socket(sock, server_hostname=self.host)
        else:
            # Take the supplied file, or FALLBACK_CACERT_FILE if nothing
            # was supplied.
            cacert_file = self.cacert_file or FALLBACK_CACERT_FILE
            sock = ssl.wrap_socket(sock, ca_certs=cacert_file,
                                   cert_reqs=ssl.CERT_REQUIRED)

        self.sock = sock
def connect(self):
        "Connect to a host on a given (SSL) port."
        sock = socket.create_connection((self.host, self.port),
                                        self.timeout, self.source_address)
        if self._tunnel_host:
            self.sock = sock
            self._tunnel()

        # Python 2.7.9+
        if create_default_context:
            # Newer python will use the "right" cacert file automatically. So
            # the default of None can safely be passed along.
            ctx = create_default_context(cafile=self.cacert_file)
            sock = ctx.wrap_socket(sock, server_hostname=self.host)
        else:
            # Take the supplied file, or FALLBACK_CACERT_FILE if nothing
            # was supplied.
            cacert_file = self.cacert_file or FALLBACK_CACERT_FILE
            sock = ssl.wrap_socket(sock, ca_certs=cacert_file,
                                   cert_reqs=ssl.CERT_REQUIRED)

        self.sock = sock
Connect to a host on a given (SSL) port.