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
andexample-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
- class streamlink.options.Argument(name, action=None, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, dest=None, requires=None, prompt=None, sensitive=False, argument_name=None)#
Bases:
object
Accepts most of the parameters accepted by
argparse.ArgumentParser.add_argument()
, except thatname
is the name relative to the plugin name (can be overridden byargument_name
) and that only one argument name is supportedaction
must be a string and can't be a customAction
required
is a special case which is only enforced if the plugin is in use
This class should not be instantiated directly. See the
pluginargument
decorator for adding custom plugin arguments.- Parameters:
name (str) -- Argument name, without leading
--
or plugin name prefixes, e.g."username"
,"password"
, etc.action (str | None) -- See
ArgumentParser.add_argument()
nargs (int | Literal['?', '*', '+'] | None) -- See
ArgumentParser.add_argument()
const (Any) -- See
ArgumentParser.add_argument()
default (Any) -- See
ArgumentParser.add_argument()
type (Callable[[Any], _TChoices | Any] | None) -- See
ArgumentParser.add_argument()
choices (_TChoices | None) -- See
ArgumentParser.add_argument()
required (bool) -- See
ArgumentParser.add_argument()
help (str | None) -- See
ArgumentParser.add_argument()
metavar (str | List[str] | Tuple[str, ...] | None) -- See
ArgumentParser.add_argument()
dest (str | None) -- See
ArgumentParser.add_argument()
requires (str | List[str] | Tuple[str, ...] | None) -- List of other arguments which this argument requires, e.g.
["password"]
prompt (str | None) -- If the argument is required and not set, then this prompt message will be shown instead
sensitive (bool) -- Whether the argument is sensitive and should be masked (passwords, etc.)
argument_name (str | None) -- Custom CLI argument name without the automatically added plugin name prefix