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 (Optional[Mapping[str, Any]]) --
- 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 (Optional[str]) -- See
ArgumentParser.add_argument()
nargs (Optional[Union[int, Literal['?', '*', '+']]]) -- See
ArgumentParser.add_argument()
const (Any) -- See
ArgumentParser.add_argument()
default (Any) -- See
ArgumentParser.add_argument()
type (Optional[Callable[[Any], Union[_TChoices, Any]]]) -- See
ArgumentParser.add_argument()
choices (Optional[_TChoices]) -- See
ArgumentParser.add_argument()
required (bool) -- See
ArgumentParser.add_argument()
help (Optional[str]) -- See
ArgumentParser.add_argument()
metavar (Optional[Union[str, List[str], Tuple[str, ...]]]) -- See
ArgumentParser.add_argument()
dest (Optional[str]) -- See
ArgumentParser.add_argument()
requires (Optional[Union[str, List[str], Tuple[str, ...]]]) -- List of other arguments which this argument requires, e.g.
["password"]
prompt (Optional[str]) -- 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 (Optional[str]) -- Custom CLI argument name without the automatically added plugin name prefix