當前位置: 首頁>>代碼示例>>Python>>正文


Python options.print_headers方法代碼示例

本文整理匯總了Python中tornado.options.options.print_headers方法的典型用法代碼示例。如果您正苦於以下問題:Python options.print_headers方法的具體用法?Python options.print_headers怎麽用?Python options.print_headers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.options.options的用法示例。


在下文中一共展示了options.print_headers方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import print_headers [as 別名]
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(arg,
                                    follow_redirects=options.follow_redirects,
                                    validate_cert=options.validate_cert,
                                    )
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(native_str(response.body))
    client.close() 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:26,代碼來源:httpclient.py

示例2: main

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import print_headers [as 別名]
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(arg,
                                    follow_redirects=options.follow_redirects,
                                    validate_cert=options.validate_cert,
                                    )
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(response.body)
    client.close() 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:26,代碼來源:httpclient.py

示例3: main

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import print_headers [as 別名]
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(arg,
                                    follow_redirects=options.follow_redirects,
                                    validate_cert=options.validate_cert,
                                    )
        except HTTPError, e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            #print response.headers
            ht.logger.info(response.headers)
        if options.print_body:
            #print response.body
            ht.logger.info(response.body) 
開發者ID:omererdem,項目名稱:honeything,代碼行數:27,代碼來源:httpclient.py

示例4: main

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import print_headers [as 別名]
def main() -> None:
    from tornado.options import define, options, parse_command_line

    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    define("proxy_host", type=str)
    define("proxy_port", type=int)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(
                arg,
                follow_redirects=options.follow_redirects,
                validate_cert=options.validate_cert,
                proxy_host=options.proxy_host,
                proxy_port=options.proxy_port,
            )
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(native_str(response.body))
    client.close() 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:32,代碼來源:httpclient.py

示例5: main

# 需要導入模塊: from tornado.options import options [as 別名]
# 或者: from tornado.options.options import print_headers [as 別名]
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    define("proxy_host", type=str)
    define("proxy_port", type=int)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(arg,
                                    follow_redirects=options.follow_redirects,
                                    validate_cert=options.validate_cert,
                                    proxy_host=options.proxy_host,
                                    proxy_port=options.proxy_port,
                                    )
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(native_str(response.body))
    client.close() 
開發者ID:tp4a,項目名稱:teleport,代碼行數:30,代碼來源:httpclient.py


注:本文中的tornado.options.options.print_headers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。