Options#

class streamlink.options.Options(defaults=None)#

Bases: object

For storing options to be used by the Streamlink session and plugins, with default values.

Note: Option names are normalized by replacing "_" with "-".

This means that the keys example_one and example-one are equivalent.

Parameters:

defaults (Mapping[str, Any] | None) --

clear()#

Restore default options

Return type:

None

get(key)#

Get the stored value of a specific key

Parameters:

key (str) --

Return type:

Any

get_explicit(key)#

Get the stored value of a specific key and ignore any get-mappings

Parameters:

key (str) --

Return type:

Any

set(key, value)#

Set the value for a specific key

Parameters:
  • key (str) --

  • value (Any) --

Return type:

None

set_explicit(key, value)#

Set the value for a specific key and ignore any set-mappings

Parameters:
  • key (str) --

  • value (Any) --

Return type:

None

update(options)#

Merge options

Parameters:

options (Mapping[str, Any]) --

Return type:

None

_MAP_GETTERS: ClassVar[Mapping[str, Callable[[Any, str], Any]]] = {}#

Optional getter mapping for Options subclasses

_MAP_SETTERS: ClassVar[Mapping[str, Callable[[Any, str, Any], None]]] = {}#

Optional setter mapping for Options subclasses

class streamlink.options.Argument(name, required=False, requires=None, prompt=None, sensitive=False, argument_name=None, dest=None, **options)#

Bases: object

Accepts most of the parameters accepted by ArgumentParser.add_argument(), except that requires is a special case which is only enforced if the plugin is in use. In addition, the name parameter is the name relative to the plugin name, but can be overridden by argument_name.

Should not be called directly, see the pluginargument decorator.

Parameters:
  • name (str) -- Argument name, without leading -- or plugin name prefixes, e.g. "username", "password", etc.

  • required (bool) -- Whether the argument is required for the plugin

  • requires (str | Sequence[str] | None) -- List of arguments which this argument requires, eg ["password"]

  • prompt (str | None) -- If the argument is required and not set, this prompt message will be shown instead

  • sensitive (bool) -- Whether the argument is sensitive (passwords, etc.) and should be masked

  • argument_name (str | None) -- Custom CLI argument name without plugin name prefix

  • dest (str | None) -- Custom plugin option name

  • options -- Arguments passed to ArgumentParser.add_argument(), excluding requires and dest

class streamlink.options.Arguments(*args)#

Bases: object

A collection of Argument instances for Plugin classes.

Should not be called directly, see the pluginargument decorator.

requires(name)#

Find all Argument instances required by name

Parameters:

name (str) --

Return type:

Iterator[Argument]