flexget Package

flexget Package

flexget.__init__.main(args: Sequence[str] | None = None)

Main entry point for Command Line Interface

api Module

config_schema Module

exception flexget.config_schema.ConfigError

Bases: ValueError

errors: List[ConfigValidationError]
exception flexget.config_schema.ConfigValidationError(message, validator=<unset>, path=(), cause=None, context=(), validator_value=<unset>, instance=<unset>, schema=<unset>, schema_path=(), parent=None, type_checker=<unset>)

Bases: ValidationError

json_pointer: str
class flexget.config_schema.RefResolver(*args, **kwargs)

Bases: RefResolver

flexget.config_schema.get_schema() Dict[str, Any]
flexget.config_schema.is_episode_identifier(instance) bool
flexget.config_schema.is_file(instance) bool
flexget.config_schema.is_interval(interval_string) bool
flexget.config_schema.is_json(instance) bool
flexget.config_schema.is_path(instance) bool
flexget.config_schema.is_percent(percent_string) bool
flexget.config_schema.is_regex(instance) bool | Pattern
flexget.config_schema.is_size(size_string) bool
flexget.config_schema.is_time(time_string) bool
flexget.config_schema.is_url(instance) None | bool | Match
flexget.config_schema.is_valid_template(instance) bool
flexget.config_schema.one_or_more(schema: Dict[str, Any], unique_items: bool = False) Dict[str, Any]

Helper function to construct a schema that validates items matching schema or an array containing items matching schema.

flexget.config_schema.parse_interval(interval_string: str) timedelta

Takes an interval string from the config and turns it into a datetime.timedelta object.

flexget.config_schema.parse_percent(percent_input: str) float

Takes a percent string from the config and turns it into a float.

flexget.config_schema.parse_size(size_input: str, si: bool = False) int

Takes a size string from the config and turns it into int(bytes).

flexget.config_schema.parse_time(time_string: str) time

Parse a time string from the config into a datetime.time object.

flexget.config_schema.process_config(config: Any, schema: Dict[str, Any] | None = None, set_defaults: bool = True) List[ConfigValidationError]

Validates the config, and sets defaults within it if set_defaults is set. If schema is not given, uses the root config schema.


A list with :class:`jsonschema.ValidationError`s if any

flexget.config_schema.register_config_key(key: str, schema: Dict[str, Any], required: bool = False)

Registers a valid root level key for the config.

  • key (string) – Name of the root level key being registered.

  • schema (dict) – Schema for the key.

  • required (bool) – Specify whether this is a mandatory key.

flexget.config_schema.register_schema(path: str, schema: Dict[str, Any] | Callable[[...], Dict[str, Any]])

Register schema to be available at path for $refs

  • path – Path to make schema available

  • schema – The schema, or function which returns the schema

flexget.config_schema.resolve_ref(uri: str) Dict[str, Any]

Finds and returns a schema pointed to by uri that has been registered in the register_schema function.

flexget.config_schema.select_child_errors(validator, errors)

Looks through subschema errors, if any subschema is determined to be the intended one, (based on ‘type’ keyword errors,) errors from its branch will be released instead of the parent error.

flexget.config_schema.set_error_message(error: ValidationError) None

Create user facing error message from a jsonschema.ValidationError error

flexget.config_schema.validate_anyOf(validator, anyOf, instance, schema)
flexget.config_schema.validate_deprecated(validator, message, instance, schema)

Not really a validator, just warns if deprecated section of config is being used.

flexget.config_schema.validate_oneOf(validator, oneOf, instance, schema)
flexget.config_schema.validate_properties_w_defaults(validator, properties, instance, schema)

db_schema Module

class flexget.db_schema.FlexgetVersion

Bases: Base

class flexget.db_schema.PluginSchema(plugin, version=0)

Bases: Base

exception flexget.db_schema.UpgradeImpossible

Bases: Exception

Exception to be thrown during a db upgrade function which will cause the old tables to be removed and recreated from the new model.

class flexget.db_schema.VersionedBaseMeta(metaname, bases, dict_)

Bases: DeclarativeMeta

Metaclass for objects returned by versioned_base factory

register_table(table: str | Table) None

This can be used if a plugin is declaring non-declarative sqlalchemy tables.


table – Can either be the name of the table, or an sqlalchemy.Table instance.

flexget.db_schema.after_table_create(target, connection, tables: List[Table] | None = None, **kw) None

Sets the schema version to most recent for a plugin when it’s tables are freshly created.

flexget.db_schema.get_flexget_db_version() str | None
flexget.db_schema.register_plugin_table(tablename: str, plugin: str, version: int)
flexget.db_schema.set_flexget_db_version(manager=None) None
flexget.db_schema.upgrade(plugin: str) Callable

Used as a decorator to register a schema upgrade function.

The wrapped function will be passed the current schema version and a session object. The function should return the new version of the schema after the upgrade.

There is no need to commit the session, it will commit automatically if an upgraded schema version is returned.


from flexget import schema
def upgrade(ver, session):
     if ver == 2:
         # upgrade
         ver = 3
     return ver
flexget.db_schema.versioned_base(plugin: str, version: int) VersionedBaseMeta

Returns a class which can be used like Base, but automatically stores schema version when tables are created.

entry Module

class flexget.entry.Entry(*args, **kwargs)

Bases: LazyDict, Serializer

Represents one item in task. Must have url and title fields.

Stores automatically original_url key, which is necessary because plugins (eg. urlrewriters) may change url into something else and otherwise that information would be lost.

Entry will also transparently convert all ascii strings into unicode and raises EntryUnicodeError if conversion fails on any value being set. Such failures are caught by Task and trigger abort().

accept(reason: str | None = None, **kwargs) None
property accepted: bool
add_hook(action: str, func: Callable, **kwargs) None

Add a hook for action to this entry.

  • action (string) – One of: ‘accept’, ‘reject’, ‘fail’, ‘complete’

  • func – Function to execute when event occurs

  • kwargs – Keyword arguments that should be passed to func


ValueError when given an invalid action

add_lazy_fields(lazy_func: Callable[[Entry], None] | str, fields: Iterable[str], args: Sequence | None = None, kwargs: Mapping | None = None)

Add lazy fields to an entry. :param lazy_func: should be a funciton previously registered with the register_lazy_func decorator,

or the name it was registered under.

  • fields – list of fields this function will fill

  • args – Arguments that will be passed to the lazy lookup function when called.

  • kwargs – Keyword arguments which will be passed to the lazy lookup function when called.

classmethod deserialize(data, version) Entry

Returns an instance of the original class, recreated from the serialized form.

fail(reason: str | None = None, **kwargs)
property failed: bool
isvalid() bool

True if entry is valid. Return False if this cannot be used.

Return type:


on_accept(func: Callable, **kwargs) None

Register a function to be called when this entry is accepted.

  • func – The function to call

  • kwargs – Keyword arguments that should be passed to the registered function

on_complete(func: Callable, **kwargs) None

Register a function to be called when a Task has finished processing this entry.

  • func – The function to call

  • kwargs – Keyword arguments that should be passed to the registered function

on_fail(func: Callable, **kwargs) None

Register a function to be called when this entry is failed.

  • func – The function to call

  • kwargs – Keyword arguments that should be passed to the registered function

on_reject(func: Callable, **kwargs) None

Register a function to be called when this entry is rejected.

  • func – The function to call

  • kwargs – Keyword arguments that should be passed to the registered function

register_lazy_func(func, keys)

DEPRECATED. Use add_lazy_fields instead.

reject(reason: str | None = None, **kwargs) None
property rejected: bool
render(template: str | FlexGetTemplate, native: bool = False) str

Renders a template string based on fields in the entry.

  • template – A template string or FlexGetTemplate that uses jinja2 or python string replacement format.

  • native – If True, and the rendering result can be all native python types, not just strings.


The result of the rendering.

Return type:



RenderError – If there is a problem.

run_hooks(action: str, **kwargs) None

Run hooks that have been registered for given action.

  • action – Name of action to run hooks for

  • kwargs – Keyword arguments that should be passed to the registered functions

safe_str() str
classmethod serialize(entry: Entry) dict

This method should be implemented to return a plain python datatype which is json serializable.

property state: EntryState
trace(message: str | None, operation: str | None = None, plugin: str | None = None) None

Adds trace message to the entry which should contain useful information about why plugin did not operate on entry. Accept and Reject messages are added to trace automatically.

  • message (string) – Message to add into entry trace.

  • operation (string) – None, reject, accept or fail

  • plugin – Uses task.current_plugin by default, pass value to override

property undecided: bool
update_using_map(field_map: dict, source_item: dict | object, ignore_none: bool = False)

Populates entry fields from a source object using a dictionary that maps from entry field names to attributes (or keys) in the source object.

  • field_map (dict) – A dictionary mapping entry field names to the attribute in source_item (or keys, if source_item is a dict)(nested attributes/dicts are also supported, separated by a dot,) or a function that takes source_item as an argument

  • source_item – Source of information to be used by the map

  • ignore_none – Ignore any None values, do not record it to the Entry

class flexget.entry.EntryState(value)

Bases: Enum

An enumeration.

ACCEPTED = 'accepted'
FAILED = 'failed'
REJECTED = 'rejected'
UNDECIDED = 'undecided'
property color: str
property log_markup: str
exception flexget.entry.EntryUnicodeError(key: str, value)

Bases: Exception

This exception is thrown when trying to set non-unicode compatible field value to entry.

class flexget.entry.LazyFunc(lazy_func_name: str)

Bases: object

property function: Callable

alias of LazyFunc

event Module

Provides small event framework

class flexget.event.Event(name: str, func: Callable, priority: int = 128)

Bases: object

Represents one registered event.

flexget.event.add_event_handler(name: str, func: Callable, priority: int = 128) Event
  • name (string) – Event name

  • func (function) – Function that acts as event handler

  • priority – Priority for this hook


Event created

Return type:



Exception – If func is already registered in an event

flexget.event.event(name: str, priority: int = 128) Callable[[Callable], Callable]

Register event to function with a decorator

flexget.event.fire_event(name: str, *args, **kwargs) Any

Trigger an event with name. If event is not hooked by anything nothing happens. If a function that hooks an event returns a value, it will replace the first argument when calling next function.

  • name – Name of event to be called

  • args – List of arguments passed to handler function

  • kwargs – Key Value arguments passed to handler function

flexget.event.get_events(name: str) List[Event]

name (String) – event name


List of Event for name ordered by priority

flexget.event.remove_event_handler(name: str, func: Callable) None

Remove func from the handlers for event name.

flexget.event.remove_event_handlers(name: str) None

Removes all handlers for given event name.

ipc Module

class flexget.ipc.ClientService

Bases: Service

exposed_console(text, *args, **kwargs)

called when the connection is established

class flexget.ipc.DaemonService

Bases: Service

property client_out_stream
manager = None

called when the connection is established

class flexget.ipc.IPCClient(port, password: str)

Bases: object

class flexget.ipc.IPCServer(manager, port=None)

Bases: object

class flexget.ipc.RemoteStream(writer: Callable | None)

Bases: object

Used as a filelike to stream text to remote client. If client disconnects while this is in use, an error will be logged, but no exception raised.

flush() None
write(text: str) None

logger Module

manager Module

class flexget.manager.Manager(args: List[str])

Bases: object

Manager class for FlexGet

Fires events:

  • manager.initialize

    The first time the manager is initialized, before config is loaded

  • manager.before_config_load

    Before the config file is loaded from disk

  • manager.before_config_validate

    When updating the config, before the validator is run on it

  • manager.config_updated

    After a configuration file has been loaded or changed (and validated) this event is fired

  • manager.startup

    After manager has been initialized. This is when application becomes ready to use, however no database lock is present, so the database must not be modified on this event.

  • manager.lock_acquired

    The manager does not always require a lock on startup, if one is requested, this event will run when it has been acquired successfully

  • manager.upgrade

    If any plugins have declared a newer schema version than exists in the database, this event will be fired to allow plugins to upgrade their tables

  • manager.shutdown_requested

    When shutdown has been requested. Any plugins which might add to execution queue should stop when this is fired.

  • manager.shutdown

    When the manager is exiting

  • manager.execute.completed

    If execution in current process was completed

  • manager.daemon.started

  • manager.daemon.completed

  • manager.db_cleanup

acquire_lock(event: bool = True) Iterator

event (bool) – If True, the ‘manager.lock_acquired’ event will be fired after a lock is obtained

backup_config() str
check_ipc_info() dict | None

If a daemon has a lock on the database, return info to connect to IPC.

check_lock() bool

Returns True if there is a lock on the database.

config_changed() None

Makes sure that all tasks will have the config_modified flag come out true on the next run. Useful when changing the db and all tasks need to be completely reprocessed.

crash_report() str

This should be called when handling an unexpected exception. Will create a new log file containing the last 50 debug messages as well as the crash traceback.

daemon_command(options: Namespace) None

Handles the ‘daemon’ CLI command.

Fires events:

  • manager.daemon.started

  • manager.daemon.completed


options – argparse options

daemonize() None

Daemonizes the current process. Returns the new pid

db_cleanup(force: bool = False) None

Perform database cleanup if cleanup interval has been met.

Fires events:

  • manager.db_cleanup

    If interval was met. Gives session to do the cleanup as a parameter.


force (bool) – Run the cleanup no matter whether the interval has been met.

execute(options: dict | Namespace | None = None, priority: int = 1, suppress_warnings: Sequence[str] | None = None) List[Tuple[str, str, Event]]

Run all (can be limited with options) tasks from the config.

  • options – Either an argparse.Namespace instance, or a dict, containing options for execution

  • priority – If there are other executions waiting to be run, they will be run in priority order, lowest first.

  • suppress_warnings – Allows suppressing log warning about missing plugin in key phases


a list of threading.Event instances which will be set when each respective task has finished running

execute_command(options: Namespace) None

Handles the ‘execute’ CLI command.

If there is already a task queue running in this process, adds the execution to the queue. If FlexGet is being invoked with this command, starts up a task queue and runs the execution.

Fires events:

  • manager.execute.started

  • manager.execute.completed


options – argparse options

handle_cli(options: Namespace | None = None) None

Dispatch a cli command to the appropriate function.

The manager should have a lock and be initialized before calling this method.


options – argparse options for command. Defaults to options that manager was instantiated with.

property has_lock: bool
hash_config() str | None
init_sqlalchemy() None

Initialize SQLAlchemy

initialize() None

Load plugins, database, and config. Also initializes (but does not start) the task queue and ipc server. This should only be called after obtaining a lock.

load_config(output_to_console: bool = True, config_file_hash: str | None = None) None

Loads the config file from disk, validates and activates it.


ValueError if there is a problem loading the config file

matching_tasks(task: str) List[str] | None

Create list of tasks to run, preserving order

options: Namespace
static parse_initial_options(args: List[str]) Namespace

Parse what we can from cli args before plugins are loaded.

release_lock() None
save_config() None

Dumps current config to yaml config file

setup_yaml() None

Customize the yaml loader/dumper behavior

shutdown(finish_queue: bool = True) None

Request manager shutdown.


finish_queue (bool) – Should scheduler finish the task queue

start() None

Starting point when executing from commandline, dispatch execution to correct destination.

If there is a FlexGet process with an ipc server already running, the command will be sent there for execution and results will be streamed back. If not, this will attempt to obtain a lock, initialize the manager, and run the command here.

property tasks: List[str]

A list of tasks in the config

unit_test = False
update_config(config: dict) None

Provide a new config for the manager to use.


ValueError and rolls back to previous config if the provided config is not valid.

validate_config(config: dict | None = None) dict

Check all root level keywords are valid. Config may be modified by before_config_validate hooks. Modified config will be returned.


config – Config to check. If not provided, current manager config will be checked.


ValueError when config fails validation. There will be an errors attribute with the schema errors.


Final validated config.

write_lock(ipc_info: dict | None = None) None

options Module

class flexget.options.ArgumentParser(**kwargs)

Bases: ArgumentParser

Mimics the default argparse.ArgumentParser class, with a few distinctions, mostly to ease subparser usage:

  • If add_subparsers is called with the nested_namespaces kwarg, all subcommand options will be stored in a nested namespace based on the command name for the subparser

  • Adds the add_subparser method. After add_subparsers has been called, the add_subparser method can be used instead of the add_parser method of the object returned by the add_subparsers call.

  • add_subparser takes takes the parent_defaults argument, which will set/change the defaults for the parent parser when that subparser is selected.

  • The get_subparser method will get the ArgumentParser instance for an existing subparser on this parser

  • For any arguments defined both in this parser and one of its subparsers, the selected subparser default will override the main one.

  • Adds the set_post_defaults method. This works like the normal argparse set_defaults method, but all actions and subparsers will be run before any of these defaults are set.

  • Command shortening: If the command for a subparser is abbreviated unambiguously, it will still be accepted.

  • The add_argument nargs keyword argument supports a range of arguments, e.g. `”2-4”

  • If the raise_errors keyword argument to parse_args is True, a ParserError will be raised instead of sys.exit

  • If the file argument is given to parse_args, output will be printed there instead of sys.stdout or stderr

add_argument(dest, ..., name=value, ...)
add_argument(option_string, option_string, ..., name=value, ...) None
add_subparser(name: str, **kwargs)

Adds a parser for a new subcommand and returns it.

  • name – Name of the subcommand

  • parent_defaults – Default argument values which should be supplied to the parent parser if this subparser is selected.


nested_namespaces – If True, options from subparsers will appear in nested namespace under the subparser name.

do_help = True
error(message: string)

Prints a usage message incorporating the message to stderr and exits.

If you override this in a subclass, it should not return – it should either exit or raise an exception.

file: IO[str] | None = None
get_subparser(name: str, default=<object object>)
parse_args(args: List[str] | None = None, namespace: Namespace | None = None, raise_errors: bool = False, file: TextIO | None = None)

raise_errors – If this is true, errors will be raised as `ParserError`s instead of calling sys.exit

parse_known_args(args: List[str] | None = None, namespace: Namespace | None = None, do_help: bool | None = None)

Like set_defaults method, but these defaults will be defined after parsing instead of before.

class flexget.options.CoreArgumentParser(**kwargs)

Bases: ArgumentParser

The core argument parser, contains the manager arguments, command parsers, and plugin arguments.

Warning: Only gets plugin arguments if instantiated after plugins have been loaded.


nested_namespaces – If True, options from subparsers will appear in nested namespace under the subparser name.

parse_args(*args, **kwargs)

raise_errors – If this is true, errors will be raised as `ParserError`s instead of calling sys.exit

class flexget.options.CronAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: Action

class flexget.options.DebugAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: Action

class flexget.options.DebugTraceAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: Action

class flexget.options.HelpAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: Action

Override the default help command so that we can conditionally disable it to prevent program exit.

class flexget.options.InjectAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: Action

class flexget.options.NestedSubparserAction(*args, **kwargs)

Bases: _SubParsersAction

add_parser(name: str, parent_defaults: dict | None = None, **kwargs)
class flexget.options.ParseExtrasAction(option_strings, parser, help=None, metavar=None, dest=None, required=False)

Bases: Action

This action will take extra arguments, and parser them with a different parser.

exception flexget.options.ParserError(message, parser)

Bases: Exception

class flexget.options.ScopedNamespace(**kwargs)

Bases: Namespace

class flexget.options.VersionAction(option_strings, version=None, dest='==SUPPRESS==', default='==SUPPRESS==', help="show program's version number and exit")

Bases: _VersionAction

Action to print the current version. Also checks latest release revision.

flexget.options.get_parser(command: str | None = None) ArgumentParser
flexget.options.register_command(command: str, callback: Callable[[Manager, Namespace], Any], **kwargs) ArgumentParser

Register a callback function to be executed when flexget is launched with the given command.

  • command – The command being defined.

  • callback – Callback function executed when this command is invoked from the CLI. Should take manager instance and parsed argparse namespace as parameters.

  • kwargs – Other keyword arguments will be passed to the arparse.ArgumentParser constructor


An argparse.ArgumentParser instance ready to be configured with the options for this command.

flexget.options.required_length(nmin: int, nmax: int)

Generates a custom Action to validate an arbitrary range of arguments.

plugin Module

exception flexget.plugin.DependencyError(issued_by: str | None = None, missing: str | None = None, message: str | None = None, silent: bool = False)

Bases: Exception

Plugin depends on other plugin, but it cannot be loaded.


issued_by: name of the plugin trying to do the import missing: name of the plugin or library that is missing message: customized user readable error message

All args are optional.

has_message() bool
property message: str
exception flexget.plugin.PluginError(value, logger: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)

Bases: Exception

class flexget.plugin.PluginInfo(plugin_class: type, name: str | None = None, interfaces: List[str] | None = None, builtin: bool = False, debug: bool = False, api_ver: int = 1, category: str | None = None)

Bases: dict

Allows accessing key/value pairs of this dictionary subclass via attributes. Also instantiates a plugin and initializes properties.

build_phase_handlers() None

(Re)build phase_handlers in this plugin

dupe_counter = 0
initialize() None
exception flexget.plugin.PluginWarning(value, logger: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)

Bases: Warning

exception flexget.plugin.RegisterException(value)

Bases: Exception

flexget.plugin.get(name: str, requested_by: str | object) object
  • name (str) – Name of the requested plugin

  • requested_by – Plugin class instance OR string value who is making the request.


Instance of Plugin class

flexget.plugin.get_phases_by_plugin(name: str) List[str]

Return all phases plugin :name: hooks

flexget.plugin.get_plugin_by_name(name: str, issued_by: str = '???') PluginInfo

Get plugin by name, preferred way since this structure may be changed at some point.

Getting plugin via .get function is recommended for normal use.

This results much shorter and cleaner code:


Shortens into:

plugin.get('parsing', self).parse_movie(data=entry['title'])

This function is still useful if you need to access plugin information (PluginInfo).

:returns PluginInfo instance

flexget.plugin.get_plugins(phase: str | None = None, interface: str | None = None, category: str | None = None, name: str | None = None, min_api: int | None = None) Iterable[PluginInfo]

Query other plugins characteristics.

  • phase (string) – Require phase

  • interface (string) – Plugin must implement this interface.

  • category (string) – Type of plugin, phase names.

  • name (string) – Name of the plugin.

  • min_api (int) – Minimum api version.


List of PluginInfo instances.

Return type:


class flexget.plugin.internet(logger_: loguru.Logger = <loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>)

Bases: object

@internet decorator for plugin phase methods.

Catches all internet related exceptions and raises PluginError with relevant message. Task handles PluginErrors by aborting the task.

flexget.plugin.load_plugins(extra_plugins: List[str] | None = None, extra_components: List[str] | None = None) None

Load plugins from the standard plugin and component paths.

  • extra_plugins (list) – Extra directories from where plugins are loaded.

  • extra_components (list) – Extra directories from where components are loaded.

flexget.plugin.plugin_schemas(**kwargs) Dict[str, Any]

Create a dict schema that matches plugins specified by kwargs

flexget.plugin.priority(value: int) Callable[[Callable], Callable]

Priority decorator for phase methods


alias of PluginInfo

flexget.plugin.register_task_phase(name: str, before: str | None = None, after: str | None = None)

Adds a new task phase to the available phases.

task Module

class flexget.task.EntryContainer(iterable: list | None = None)

Bases: list

Container for a list of entries, also contains accepted, rejected failed iterators over them.

property accepted
property entries
property failed
property rejected
property undecided
class flexget.task.EntryIterator(entries: List[Entry], states: EntryState | Iterable[EntryState])

Bases: object

An iterator over a subset of entries to emulate old task.accepted/rejected/failed/entries properties.

sort(*args, **kwargs)
class flexget.task.Task(manager, name, config=None, options=None, output=None, session_id=None, priority=None, suppress_warnings=None)

Bases: object

Represents one task in the configuration.

Fires events:

  • task.execute.before_plugin

    Before a plugin is about to be executed. Note that since this will also include all builtin plugins the amount of calls can be quite high

    parameters: task, keyword

  • task.execute.after_plugin

    After a plugin has been executed.

    parameters: task, keyword

  • task.execute.started

    Before a task starts execution

  • task.execute.completed

    After task execution has been completed

    parameters: task

abort(reason='Unknown', silent=False, traceback: str | None = None)

Abort this task execution, no more plugins will be executed except the abort handling ones.

property accepted

Deprecated since version Use: API v3

property all_entries

Deprecated since version Use: API v3


Checks the task’s config hash and updates the hash if necessary.


Sets config_modified flag to True for the remainder of this run. Used when the db changes, and all entries need to be reprocessed.


Disable phase from execution.


phase (string) – Name of phase


ValueErrorphase could not be found.


Disable plugin from execution.


plugin (string) – Name of plugin


ValueErrorplugin could not be found.

property entries

Deprecated since version Use: API v3


Executes the the task.

If enabled is False task is not executed. Certain options affect how execution is handled.

  • options.disable_phases is a list of phases that are not enabled for this execution.

  • options.inject is a list of Entry instances used instead of running input phase.

property failed

Deprecated since version Use: API v3

find_entry(category='entries', **values)

Find and return Entry with given attributes from task or None

  • category (string) – entries, accepted, rejected or failed. Defaults to entries.

  • values – Key values of entries to be searched


Entry or None

property is_rerun

Prevent modification of max_reruns property

property max_reruns

How many times task can be rerunned before stopping


Get currently enabled plugins.


phase (string) – Optional, limits to plugins currently configured on given phase, sorted in phase order.


An iterator over configured flexget.plugin.PluginInfo instances enabled on this task.

property rejected

Deprecated since version Use: API v3


Renders a template string based on fields in the entry.


template – A template string or FlexGetTemplate that uses jinja2 or python string replacement format.


The result of the rendering.

Return type:



RenderError – If there is a problem.

rerun(plugin=None, reason=None)

Immediately re-run the task after execute has completed, task can be re-run up to max_reruns times.

  • plugin (str) – Plugin name

  • reason (str) – Why the rerun is done

property rerun_count
property reruns_locked
property undecided

Deprecated since version Use: API v3


We did not migrate to v3

If I remember correctly the idea was to make v3 signature on_task_xxx(task, config, entries)

Param entries would be EntryContainer, which has convenience iterator methods:

  • entries.accepted

  • entries.failed

  • etc, which you see here


Allow modification of max_reruns property

static validate_config(config)
exception flexget.task.TaskAbort(reason: str, silent: bool = False)

Bases: Exception

class flexget.task.TaskConfigHash(**kwargs)

Bases: VersionedBase

Stores the config hash for tasks so that we can tell if the config has changed since last run.


task_queue Module

class flexget.task_queue.TaskQueue

Bases: object

Task processing thread.

Only executes one task at a time, if more are requested they are queued up and run in turn.

is_alive() bool
put(task: Task)

Adds a task to be executed to the queue.

run() None
shutdown(finish_queue: bool = True) None

Request shutdown.


finish_queue (bool) – Should all tasks be finished before ending thread.

start() None
wait() None

Waits for the thread to exit.

Allows abortion of task queue with ctrl-c

webserver Module

class flexget.webserver.User(**kwargs)

Bases: Base, UserMixin

User class available for flask apps to handle authentication using flask_login

exception flexget.webserver.WeakPassword(value, logger=<loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)

Bases: Exception

class flexget.webserver.WebSecret(**kwargs)

Bases: Base

Store flask secret in the database

class flexget.webserver.WebServer(bind='', port=5050, ssl_certificate=None, ssl_private_key=None, base_url='')

Bases: Thread


Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.


Start the thread’s activity.

It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.

This method will raise a RuntimeError if called more than once on the same thread object.

triggers_lock = <unlocked _thread.lock object>

Generate key for use to authentication

flexget.webserver.get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')

Returns a securely generated random string.

The default length of 12 with the a-z, A-Z, 0-9 character set returns a 71-bit value. log_2((26+26+10)^12) =~ 71 bits.

Taken from the django.utils.crypto module.

flexget.webserver.register_app(path, application, name)

Registers UI home page


Sets up and starts/restarts the web service.


Redirect user to registered UI home

validator Module

Deprecated since version 1.1: Use config_schema instead