Reference#
CLI Reference#
The following sections document each command-line entry point using the
sphinx_click extension, which renders the full Click help text (options,
arguments, and sub-commands) directly from the source.
valkyrie#
urlcheck#
ipcheck#
dnscheck#
whobe#
API Reference#
valkyrie_tools#
valkyrie_tools.cache#
valkyrie_tools.commons#
valkyrie_tools.config#
Configuration management for valkyrie-tools.
Wraps configparser.ConfigParser with a thin Config class
that automatically locates the per-user configuration file (using
appdirs.user_config_dir), creates the file with sensible defaults on first
run, and exposes a simple get / set / remove API. The file is
stored in INI format.
- class valkyrie_tools.config.Config(config_name, defaults=None)#
Bases:
objectA class for managing a configuration file in the user’s config directory.
- config#
The configparser for the configuration file.
- read()#
Load the configuration file from disk.
Reads
config_fileviaconfigparser.ConfigParser. If the file does not exist,configparsersilently skips it and returns an empty list.- Returns:
Paths of files successfully read (an empty list when the file does not exist yet).
- Return type:
List[str]
- save()#
Write the current in-memory configuration to disk.
Serialises
configtoconfig_fileusingconfigparser.ConfigParser. The file is created if it does not exist; intermediate directories must already exist.- Return type:
None
- get(section, option, fallback=None)#
Get the value of an option in a section.
- set(section, option, value)#
Set the value of an option in a section.
- remove_section(section)#
Remove a section from the configuration file.
- Parameters:
section (str) – The section to remove.
- Return type:
None
- remove_option(section, option)#
Remove an option from a section.
- set_defaults()#
Apply
defaultsto the in-memory configuration and save.Iterates over all
section -> {option: value}pairs indefaults, creates any missing sections, sets each option, then callssave()once to persist the full configuration. Called automatically by__init__()whendefaultsis provided and no configuration file was found on disk.- Return type:
None