exception woob.tools.application.repl.ArgSyntaxError

Bases: Exception

exception woob.tools.application.repl.NotEnoughArguments

Bases: Exception

class woob.tools.application.repl.ReplApplication

Bases: woob.tools.application.console.ConsoleApplication, woob.tools.application.repl.MyCmd

Base application class for Repl applications.

Instantiate a line-oriented interpreter framework.

The optional argument ‘completekey’ is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.


Objects to allow in do_ls / do_cd

SYNOPSIS = 'Usage: %prog [-dqv] [-b backends] [-cnfs] [command [arguments..]]\n %prog [--help] [--version]'

Get all objects that are collections: regular objects and fake dumb objects.

bcall_error_handler(backend, error, backtrace)

Handler for an exception inside the CallErrors exception.

This method can be overridden to support more exceptions types.

bcall_errors_handler(errors, ignore=())

Handler for the CallErrors exception.

complete(text, state)

Override of the Cmd.complete() method to:

  • add a space at end of proposals

  • display only proposals for words which match the text already written by user.

complete_backends(text, line, begidx, endidx)
complete_cd(text, line, begidx, endidx)
complete_formatter(text, line, *ignored)
complete_logging(text, line, begidx, endidx)
complete_ls(text, line, begidx, endidx)
complete_path(text, line, begidx, endidx)
completenames(text, *ignored)

Called on an input line when the command prefix is not recognized.

If this method is not overridden, it prints an error message and returns.

do(function, *args, **kwargs)

Call Woob.do(), passing count and selected fields given by user.


Quit the command line interpreter when ^D is pressed.



Select used backends.

ACTION is one of the following (default: list):
  • enable enable given backends

  • disable disable given backends

  • only enable given backends and disable the others

  • list list backends

  • add add a backend

  • register register a new account on a website

  • edit edit a backend

  • remove remove a backend

  • list-modules list modules


cd [PATH]

Follow a path. “..” is a special case and goes up one directory. “” is a special case and goes home.


condition [EXPRESSION | off]

If an argument is given, set the condition expression used to filter the results. See CONDITION section for more details and the expression. If the “off” value is given, conditional filtering is disabled.

If no argument is given, print the current condition expression.


count [NUMBER | off]

If an argument is given, set the maximum number of results fetched. NUMBER must be at least 1. “off” value disables counting, and allows infinite searches.

If no argument is given, print the current count value.



Launch a debug Python shell


formatter [list | FORMATTER [COMMAND] | option OPTION_NAME [on | off]]

If a FORMATTER is given, set the formatter to use. You can add a COMMAND to apply the formatter change only to a given command.

If the argument is “list”, print the available formatters.

If the argument is “option”, set the formatter options. Valid options are: header, keys. If on/off value is given, set the value of the option. If not, print the current value for the option.

If no argument is given, print the current formatter.


help [COMMAND]

List commands, or get information about a command.


logging [LEVEL]

Set logging level.

Availables: debug, info, warning, error. * quiet is an alias for error * default is an alias for warning

do_ls(*args, **kwargs)

ls [-d] [-U] [PATH]

List objects in current path. If an argument is given, list the specified path. Use -U option to not sort results. It allows you to use a “fast path” to return results as soon as possible. Use -d option to display information about a collection (and to not display the content of it). It has the same behavior than the well known UNIX “ls” command.

Default is limited to 40 results.


Quit the application.


select [FIELD_NAME]… | “$direct” | “$full”

If an argument is given, set the selected fields. $direct selects all fields loaded in one http request. $full selects all fields using as much http requests as necessary.

If no argument is given, print the currently selected fields.


By default, an emptyline repeats the previous command. Overriding this function disables this behaviour.

format(result, alias=None)
get_command_help(command, short=False)
get_object(_id, method, fields=None, caps=None)
get_object_list(method=None, *args, **kwargs)
hidden_commands = {'EOF'}
property interactive
load_backends(*args, **kwargs)

Main method

Called by run

obj_to_filename(obj, dest=None, default=None)

This method can be used to get a filename from an object, using a mask filled by information of this object.

All patterns are braces-enclosed, and are name of available fields in the object.

  • obj (BaseObject) – object

  • dest (str) – dest given by user (default None)

  • default (str) – default file mask (if not given, this is ‘{id}-{title}.{ext}’)

Return type



This REPL method is overridden to catch some particular exceptions.

parse_command_args(line, nb, req_n=None)
parse_id(id, unique_backend=False)

This REPL method is overridden to search “short” alias of commands

postcmd(stop, line)

This REPL method is overridden to return None instead of integers to prevent stopping cmdloop().


Set the current formatter from name.

It returns the name of the formatter which has been really set.

unload_backends(*args, **kwargs)
woob_commands = {'backends', 'cd', 'condition', 'count', 'formatter', 'logging', 'ls', 'quit', 'select'}
exception woob.tools.application.repl.TooManyArguments

Bases: Exception