(func)
return inner
Wrapper to change the urllib3 logging level while calling func

        This function is meant to avoid the MissingHeaderBodySeparatorDefect
        error leading to urllib3.exceptions.HeaderParsingError when parsing the
        headers. The urllib3's logging level is restricted before calling the
        given function. Subsequently, it is restored to the original level.
Wrapper to change the urllib3 logging level while calling func
Wrapper to change the urllib3 logging level while calling func
def set_urllib3_logger_critical(func):
        """Wrapper to change the urllib3 logging level while calling func

        This function is meant to avoid the MissingHeaderBodySeparatorDefect
        error leading to urllib3.exceptions.HeaderParsingError when parsing the
        headers. The urllib3's logging level is restricted before calling the
        given function. Subsequently, it is restored to the original level.

        """
        def inner(*args, **kwargs):
            urllib3_logger = logging.getLogger('urllib3')
            urllib3_logging_level = urllib3_logger.level
            urllib3_logger.setLevel(logging.CRITICAL)
            r = func(*args, **kwargs)
            urllib3_logger.setLevel(urllib3_logging_level)
            return r

        return inner
def set_urllib3_logger_critical ( func ) : def inner ( * args , * * kwargs ) : urllib3_logger = logging . getLogger ( 'urllib3' ) urllib3_logging_level = urllib3_logger . level urllib3_logger . setLevel ( logging . CRITICAL ) r = func ( * args , * * kwargs ) urllib3_logger . setLevel ( urllib3_logging_level ) return r return inner