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


Python HTTPConnection.debuglevel方法代码示例

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


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

示例1: enable_debug_requests

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def enable_debug_requests():
    # Enabling debugging at http.client level (requests->urllib3->http.client)
    # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
    # the only thing missing will be the response.body which is not logged.
    from http.client import HTTPConnection
    import logging

    HTTPConnection.debuglevel = 1
    logger.setLevel(logging.DEBUG)
    requests_log = logging.getLogger("requests.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True


# 去掉注释,开启调试模式
# enable_debug_requests() 
开发者ID:pandalibin,项目名称:backtrader-cn,代码行数:18,代码来源:sina.py

示例2: setup_logger

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def setup_logger(log_level):
    if log_level == 'DEBUG':
        format = '%(asctime)s %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s'
        from http.client import HTTPConnection
        HTTPConnection.debuglevel = 1
        requests_log = logging.getLogger("requests.packages.urllib3")
        requests_log.setLevel(logging.DEBUG)
        requests_log.propagate = True

    else:
        format = click.style('anime', fg='green') + ': %(message)s'

    logger = logging.getLogger("anime_downloader")
    coloredlogs.install(level=log_level, fmt=format, logger=logger) 
开发者ID:vn-ki,项目名称:anime-downloader,代码行数:16,代码来源:util.py

示例3: enable_request_debugging

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def enable_request_debugging():
        # Enabling debugging at http.client level (requests->urllib3->http.client)
        # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
        # the only thing missing will be the response.body which is not logged.
        try:  # for Python 3
            from http.client import HTTPConnection
        except ImportError:
            from requests.packages.urllib3.connectionpool import HTTPConnection
        HTTPConnection.debuglevel = 1

        logging.basicConfig()  # you need to initialize logging, otherwise you will not see anything from requests
        logging.getLogger().setLevel(logging.DEBUG)
        requests_log = logging.getLogger("requests.packages.urllib3")
        requests_log.setLevel(logging.DEBUG)
        requests_log.propagate = True 
开发者ID:faaez,项目名称:capiq-python,代码行数:17,代码来源:capiq_client.py

示例4: __init__

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def __init__(self, endpoint=None, key=None, secret=None, token=None, username=None, password=None, timeout=5.0, ssl_verify=True, headers=None, debug=False):
        self.endpoint = endpoint or os.environ.get('ALERTA_ENDPOINT', self.DEFAULT_ENDPOINT)

        if debug:
            HTTPConnection.debuglevel = 1

        key = key or os.environ.get('ALERTA_API_KEY', '')
        self.http = HTTPClient(self.endpoint, key, secret, token, username, password, timeout, ssl_verify, headers, debug)

    # Alerts 
开发者ID:alerta,项目名称:python-alerta-client,代码行数:12,代码来源:api.py

示例5: _init_logging

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def _init_logging():
    HTTPConnection.debuglevel = 1
    logging.basicConfig(level=logging.DEBUG,
                        format='%(levelname)5s - %(name)s -  %(message)s')
    requests_log = logging.getLogger("requests.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True 
开发者ID:cloudfoundry-community,项目名称:cf-python-client,代码行数:9,代码来源:config_test.py

示例6: main

# 需要导入模块: from http.client import HTTPConnection [as 别名]
# 或者: from http.client.HTTPConnection import debuglevel [as 别名]
def main():
    args = parse_args()

    if args.verbose:
        log.setLevel(logging.DEBUG)
        requests_log.setLevel(logging.DEBUG)
        HTTPConnection.debuglevel = 2
        requests_log.propagate = True

    # Safety checks
    if args.no_branch and not args.YELPSOA_DIR:
        log.error(
            "You must specify --yelpsoa-configs-dir to work on if you use the --local option"
        )
        return False

    if args.ticket:
        if not args.jira_creds:
            raise ValueError("No JIRA creds specified")
        # Only import the jira module if we need too
        from jira.client import JIRA  # noqa: F401
    else:
        JIRA = None

    report = get_report_from_splunk(
        args.splunk_creds, args.splunk_app, args.csv_report, args.criteria_filter
    )

    tmpdir = tempdir()  # Create a tmp dir even if we are not using it

    working_dir = args.YELPSOA_DIR
    if working_dir is None:
        # Working in a temporary directory
        working_dir = os.path.join("rightsizer", tmpdir.name)
        clone_in(working_dir)

    with cwd(working_dir):
        if args.bulk or args.no_branch:
            log.info("Running in bulk mode")
            bulk_rightsize(
                report, args.create_reviews, args.publish_reviews, not args.no_branch
            )
        else:
            individual_rightsize(
                report,
                args.ticket,
                args.jira_creds,
                args.create_reviews,
                args.publish_reviews,
                JIRA,
            )

    tmpdir.cleanup()  # Cleanup any tmpdire used 
开发者ID:Yelp,项目名称:paasta,代码行数:55,代码来源:paasta_update_soa_memcpu.py


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