def debug(what, level): """ >> debug <what> <level> <what> can be: * http (any level >= 1), to display the HTTP transactions. * commands (any level >= 1), to display the commands being executed. * equiv-refresh (any level >= 1) to display HTTP-EQUIV refresh handling. """ from . import parse try: level = int(level) except ValueError: flag = utils.make_boolean(level) if flag: level = 1 else: level = 0 print('DEBUG: setting %s debugging to level %d' % (what, level), file=OUT) if what == "http": # @BRT: Tries to set mechanize browser debug level directly; # @CTB not something supported by requests? # browser._browser.set_debug_http(level) pass elif what == 'equiv-refresh': if level: utils._debug_print_refresh = True else: utils._debug_print_refresh = False elif what == 'commands': if level: parse.debug_print_commands(True) else: parse.debug_print_commands(False) else: raise TwillException('unknown debugging type: "%s"' % (what,))
def debug(what, level): """ >> debug <what> <level> <what> can be: * http (any level >= 1), to display the HTTP transactions. * commands (any level >= 1), to display the commands being executed. * equiv-refresh (any level >= 1) to display HTTP-EQUIV refresh handling. """ from . import parse try: level = int(level) except ValueError: flag = utils.make_boolean(level) if flag: level = 1 else: level = 0 print('DEBUG: setting %s debugging to level %d' % (what, level), file=OUT) if what == "http": # @BRT: Tries to set mechanize browser debug level directly; # @CTB not something supported by requests? # browser._browser.set_debug_http(level) pass elif what == 'equiv-refresh': if level: utils._debug_print_refresh = True else: utils._debug_print_refresh = False elif what == 'commands': if level: parse.debug_print_commands(True) else: parse.debug_print_commands(False) else: raise TwillException('unknown debugging type: "%s"' % (what, ))
def debug(what, level): """ >> debug <what> <level> <what> can be: * http (any level >= 1), to display the HTTP transactions. * commands (any level >= 1), to display the commands being executed. * equiv-refresh (any level >= 1) to display HTTP-EQUIV refresh handling. """ import parse try: level = int(level) except ValueError: flag = utils.make_boolean(level) if flag: level = 1 else: level = 0 print >> OUT, 'DEBUG: setting %s debugging to level %d' % (what, level) if what == "http": browser._browser.set_debug_http(level) elif what == 'equiv-refresh': if level: utils._debug_print_refresh = True else: utils._debug_print_refresh = False elif what == 'commands': if level: parse.debug_print_commands(True) else: parse.debug_print_commands(False) else: raise TwillException('unknown debugging type: "%s"' % (what, ))
def debug(what, level): """ >> debug <what> <level> <what> can be: * http (any level >= 1), to display the HTTP transactions. * commands (any level >= 1), to display the commands being executed. * equiv-refresh (any level >= 1) to display HTTP-EQUIV refresh handling. """ import parse try: level = int(level) except ValueError: flag = utils.make_boolean(level) if flag: level = 1 else: level = 0 print>>OUT, 'DEBUG: setting %s debugging to level %d' % (what, level) if what == "http": browser._browser.set_debug_http(level) elif what == 'equiv-refresh': if level: utils._debug_print_refresh = True else: utils._debug_print_refresh = False elif what == 'commands': if level: parse.debug_print_commands(True) else: parse.debug_print_commands(False) else: raise TwillException('unknown debugging type: "%s"' % (what,))