本文整理匯總了Python中http.client.HTTPS_PORT屬性的典型用法代碼示例。如果您正苦於以下問題:Python client.HTTPS_PORT屬性的具體用法?Python client.HTTPS_PORT怎麽用?Python client.HTTPS_PORT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類http.client
的用法示例。
在下文中一共展示了client.HTTPS_PORT屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from http import client [as 別名]
# 或者: from http.client import HTTPS_PORT [as 別名]
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
示例2: __init__
# 需要導入模塊: from http import client [as 別名]
# 或者: from http.client import HTTPS_PORT [as 別名]
def __init__(
self, username, password, server="com.sunny-portal.de", port=http.HTTPS_PORT
):
super().__init__()
self.log = logging.getLogger(__name__)
self.username = username
self.password = password
self.server = server
self.port = port
self.token = None