當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。