我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用http.client.HTTPS_PORT。
def __init__(self, uri, timeout=None, ssl_context_factory=None): """Initialize a HTTP Socket. @param uri(str) The http_scheme:://host:port/path to connect to. @param timeout timeout in ms """ parsed = urllib.parse.urlparse(uri) self.scheme = parsed.scheme assert self.scheme in ('http', 'https') if self.scheme == 'http': self.port = parsed.port or http_client.HTTP_PORT elif self.scheme == 'https': self.port = parsed.port or http_client.HTTPS_PORT self.host = parsed.hostname self.path = parsed.path if parsed.query: self.path += '?%s' % parsed.query self.__wbuf = BytesIO() self.__http = None self.__custom_headers = None self.__timeout = None if timeout: self.setTimeout(timeout) self._ssl_context_factory = ssl_context_factory