当前位置: 首页>>代码示例>>Python>>正文


Python client.HTTPSConnection方法代码示例

本文整理汇总了Python中future.backports.http.client.HTTPSConnection方法的典型用法代码示例。如果您正苦于以下问题:Python client.HTTPSConnection方法的具体用法?Python client.HTTPSConnection怎么用?Python client.HTTPSConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在future.backports.http.client的用法示例。


在下文中一共展示了client.HTTPSConnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_host_port

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def test_host_port(self):
        # Check invalid host_port

        # Note that httplib does not accept user:password@ in the host-port.
        for hp in ("www.python.org:abc", "user:password@www.python.org"):
            self.assertRaises(client.InvalidURL, client.HTTPSConnection, hp)

        for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b",
                          8000),
                         ("pypi.python.org:443", "pypi.python.org", 443),
                         ("pypi.python.org", "pypi.python.org", 443),
                         ("pypi.python.org:", "pypi.python.org", 443),
                         ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 443)):
            c = client.HTTPSConnection(hp)
            self.assertEqual(h, c.host)
            self.assertEqual(p, c.port)


# def test_main(verbose=None):
#     support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest,
#                          HTTPSTest, SourceAddressTest) 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:23,代码来源:test_httplib.py

示例2: make_connection

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def make_connection(self, host):
        if self._connection and host == self._connection[0]:
            return self._connection[1]

        if not hasattr(http_client, "HTTPSConnection"):
            raise NotImplementedError(
            "your version of http.client doesn't support HTTPS")
        # create a HTTPS connection object from a host descriptor
        # host may be a string, or a (host, x509-dict) tuple
        chost, self._extra_headers, x509 = self.get_host_info(host)
        self._connection = host, http_client.HTTPSConnection(chost,
            None, **(x509 or {}))
        return self._connection[1]

##
# Standard server proxy.  This class establishes a virtual connection
# to an XML-RPC server.
# <p>
# This class is available as ServerProxy and Server.  New code should
# use ServerProxy, to avoid confusion.
#
# @def ServerProxy(uri, **options)
# @param uri The connection point on the server.
# @keyparam transport A transport factory, compatible with the
#    standard transport class.
# @keyparam encoding The default encoding used for 8-bit strings
#    (default is UTF-8).
# @keyparam verbose Use a true value to enable debugging output.
#    (printed to standard output).
# @see Transport 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:32,代码来源:client.py

示例3: build_opener

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def build_opener(*handlers):
    """Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    """
    def isclass(obj):
        return isinstance(obj, type) or hasattr(obj, "__bases__")

    opener = OpenerDirector()
    default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
                       HTTPDefaultErrorHandler, HTTPRedirectHandler,
                       FTPHandler, FileHandler, HTTPErrorProcessor]
    if hasattr(http_client, "HTTPSConnection"):
        default_classes.append(HTTPSHandler)
    skip = set()
    for klass in default_classes:
        for check in handlers:
            if isclass(check):
                if issubclass(check, klass):
                    skip.add(klass)
            elif isinstance(check, klass):
                skip.add(klass)
    for klass in skip:
        default_classes.remove(klass)

    for klass in default_classes:
        opener.add_handler(klass())

    for h in handlers:
        if isclass(h):
            h = h()
        opener.add_handler(h)
    return opener 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:39,代码来源:request.py

示例4: https_open

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def https_open(self, req):
            return self.do_open(http_client.HTTPSConnection, req,
                context=self._context, check_hostname=self._check_hostname) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:5,代码来源:request.py

示例5: _https_connection

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def _https_connection(self, host):
            return http_client.HTTPSConnection(host,
                                           key_file=self.key_file,
                                           cert_file=self.cert_file) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:request.py

示例6: testHTTPSConnectionSourceAddress

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import HTTPSConnection [as 别名]
def testHTTPSConnectionSourceAddress(self):
        self.conn = client.HTTPSConnection(HOST, self.port,
                source_address=('', self.source_port))
        # We don't test anything here other the constructor not barfing as
        # this code doesn't deal with setting up an active running SSL server
        # for an ssl_wrapped connect() to actually return from. 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:8,代码来源:test_httplib.py


注:本文中的future.backports.http.client.HTTPSConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。