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


Python curl_httpclient.CurlAsyncHTTPClient方法代码示例

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


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

示例1: main

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def main():
    parse_command_line()
    app = Application([('/', ChunkHandler)])
    app.listen(options.port, address='127.0.0.1')

    def callback(response):
        response.rethrow()
        assert len(response.body) == (options.num_chunks * options.chunk_size)
        logging.warning("fetch completed in %s seconds", response.request_time)
        IOLoop.current().stop()

    logging.warning("Starting fetch with curl client")
    curl_client = CurlAsyncHTTPClient()
    curl_client.fetch('http://localhost:%d/' % options.port,
                      callback=callback)
    IOLoop.current().start()

    logging.warning("Starting fetch with simple client")
    simple_client = SimpleAsyncHTTPClient()
    simple_client.fetch('http://localhost:%d/' % options.port,
                        callback=callback)
    IOLoop.current().start() 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:24,代码来源:chunk_benchmark.py

示例2: main

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def main():
    parse_command_line()
    app = Application([('/', ChunkHandler)])
    app.listen(options.port, address='127.0.0.1')
    def callback(response):
        response.rethrow()
        assert len(response.body) == (options.num_chunks * options.chunk_size)
        logging.warning("fetch completed in %s seconds", response.request_time)
        IOLoop.instance().stop()

    logging.warning("Starting fetch with curl client")
    curl_client = CurlAsyncHTTPClient()
    curl_client.fetch('http://localhost:%d/' % options.port,
                      callback=callback)
    IOLoop.instance().start()

    logging.warning("Starting fetch with simple client")
    simple_client = SimpleAsyncHTTPClient()
    simple_client.fetch('http://localhost:%d/' % options.port,
                        callback=callback)
    IOLoop.instance().start() 
开发者ID:omererdem,项目名称:honeything,代码行数:23,代码来源:chunk_benchmark.py

示例3: _tornado

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def _tornado():
        try:
            import tornado.simple_httpclient as simple
        except ImportError:
            pass
        else:
            new_fetch_impl = traced_fetch_impl(
                _SimpleAsyncHTTPClient_fetch_impl
            )
            yield simple.SimpleAsyncHTTPClient, 'fetch_impl', new_fetch_impl

        try:
            import tornado.curl_httpclient as curl
        except ImportError:
            pass
        else:
            new_fetch_impl = traced_fetch_impl(
                _CurlAsyncHTTPClient_fetch_impl
            )
            yield curl.CurlAsyncHTTPClient, 'fetch_impl', new_fetch_impl 
开发者ID:uber-common,项目名称:opentracing-python-instrumentation,代码行数:22,代码来源:tornado_http.py

示例4: reset_patchers

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def reset_patchers():
    try:
        import tornado.simple_httpclient as simple
    except ImportError:
        pass
    else:
        setattr(
            simple.SimpleAsyncHTTPClient,
            'fetch_impl',
            _SimpleAsyncHTTPClient_fetch_impl,
        )
    try:
        import tornado.curl_httpclient as curl
    except ImportError:
        pass
    else:
        setattr(
            curl.CurlAsyncHTTPClient,
            'fetch_impl',
            _CurlAsyncHTTPClient_fetch_impl,
        ) 
开发者ID:uber-common,项目名称:opentracing-python-instrumentation,代码行数:23,代码来源:tornado_http.py

示例5: get_http_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def get_http_client(self):
        client = CurlAsyncHTTPClient(io_loop=self.io_loop,
                                     defaults=dict(allow_ipv6=False))
        # make sure AsyncHTTPClient magic doesn't give us the wrong class
        self.assertTrue(isinstance(client, CurlAsyncHTTPClient))
        return client 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:8,代码来源:curl_httpclient_test.py

示例6: setUp

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def setUp(self):
        super(CurlHTTPClientTestCase, self).setUp()
        self.http_client = CurlAsyncHTTPClient(self.io_loop,
                                               defaults=dict(allow_ipv6=False)) 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:6,代码来源:curl_httpclient_test.py

示例7: get_http_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def get_http_client(self):
        client = CurlAsyncHTTPClient(defaults=dict(allow_ipv6=False))
        # make sure AsyncHTTPClient magic doesn't give us the wrong class
        self.assertTrue(isinstance(client, CurlAsyncHTTPClient))
        return client 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:7,代码来源:curl_httpclient_test.py

示例8: create_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def create_client(self, **kwargs):
        return CurlAsyncHTTPClient(
            force_instance=True, defaults=dict(allow_ipv6=False), **kwargs
        ) 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:6,代码来源:curl_httpclient_test.py

示例9: get_http_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def get_http_client(self):
        client = CurlAsyncHTTPClient(io_loop=self.io_loop)
        # make sure AsyncHTTPClient magic doesn't give us the wrong class
        self.assertTrue(isinstance(client, CurlAsyncHTTPClient))
        return client 
开发者ID:viewfinderco,项目名称:viewfinder,代码行数:7,代码来源:curl_httpclient_test.py

示例10: setUp

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def setUp(self):
        super(CurlHTTPClientTestCase, self).setUp()
        self.http_client = CurlAsyncHTTPClient(self.io_loop) 
开发者ID:viewfinderco,项目名称:viewfinder,代码行数:5,代码来源:curl_httpclient_test.py

示例11: create_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def create_client(self, **kwargs):
        return CurlAsyncHTTPClient(force_instance=True,
                                   defaults=dict(allow_ipv6=False),
                                   **kwargs) 
开发者ID:tp4a,项目名称:teleport,代码行数:6,代码来源:curl_httpclient_test.py

示例12: get_http_client

# 需要导入模块: from tornado import curl_httpclient [as 别名]
# 或者: from tornado.curl_httpclient import CurlAsyncHTTPClient [as 别名]
def get_http_client(self):
        client = CurlAsyncHTTPClient(io_loop=self.io_loop)
        # make sure AsyncHTTPClient magic doesn't give us the wrong class
        self.assertTrue(isinstance(client, CurlAsyncHTTPClient))
        return client

# Remove the base class from our namespace so the unittest module doesn't
# try to run it again. 
开发者ID:omererdem,项目名称:honeything,代码行数:10,代码来源:curl_httpclient_test.py


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