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


Python support.HOST属性代码示例

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


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

示例1: make_https_server

# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import HOST [as 别名]
def make_https_server(case, certfile=CERTFILE, host=HOST, handler_class=None):
    # we assume the certfile contains both private key and certificate
    context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
    context.load_cert_chain(certfile)
    server = HTTPSServerThread(context, host, handler_class)
    flag = threading.Event()
    server.start(flag)
    flag.wait()
    def cleanup():
        if support.verbose:
            sys.stdout.write('stopping HTTPS server\n')
        server.stop()
        if support.verbose:
            sys.stdout.write('joining HTTPS thread\n')
        server.join()
    case.addCleanup(cleanup)
    return server 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:19,代码来源:ssl_servers.py

示例2: __init__

# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import HOST [as 别名]
def __init__(self, context, host=HOST, handler_class=None):
        self.flag = None
        self.server = HTTPSServer((host, 0),
                                  handler_class or RootedHTTPRequestHandler,
                                  context)
        self.port = self.server.server_port
        threading.Thread.__init__(self)
        self.daemon = True 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:10,代码来源:ssl_servers.py

示例3: testHTTPConnectionSourceAddress

# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import HOST [as 别名]
def testHTTPConnectionSourceAddress(self):
        self.conn = client.HTTPConnection(HOST, self.port,
                source_address=('', self.source_port))
        self.conn.connect()
        self.assertEqual(self.conn.sock.getsockname()[1], self.source_port) 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:7,代码来源:test_httplib.py

示例4: testHTTPSConnectionSourceAddress

# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import HOST [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

示例5: testTimeoutAttribute

# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import HOST [as 别名]
def testTimeoutAttribute(self):
        '''This will prove that the timeout gets through
        HTTPConnection and into the socket.
        '''
        # default -- use global socket timeout
        self.assertTrue(socket.getdefaulttimeout() is None)
        socket.setdefaulttimeout(30)
        try:
            httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT)
            httpConn.connect()
        finally:
            socket.setdefaulttimeout(None)
        self.assertEqual(httpConn.sock.gettimeout(), 30)
        httpConn.close()

        # no timeout -- do not use global socket default
        self.assertTrue(socket.getdefaulttimeout() is None)
        socket.setdefaulttimeout(30)
        try:
            httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT,
                                              timeout=None)
            httpConn.connect()
        finally:
            socket.setdefaulttimeout(None)
        self.assertEqual(httpConn.sock.gettimeout(), None)
        httpConn.close()

        # a value
        httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30)
        httpConn.connect()
        self.assertEqual(httpConn.sock.gettimeout(), 30)
        httpConn.close() 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:34,代码来源:test_httplib.py


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