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: object

A class for managing a configuration file in the user’s config directory.

Parameters:
config_name#

The name of the configuration file.

Type:

str

config_file#

The full path to the configuration file.

Type:

str

config#

The configparser for the configuration file.

Type:

configparser.ConfigParser

read()#

Load the configuration file from disk.

Reads config_file via configparser.ConfigParser. If the file does not exist, configparser silently 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 config to config_file using configparser.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.

Parameters:
  • section (str) – The section of the option.

  • option (str) – The name of the option.

  • fallback (Any) – The fallback value if the option is not found. Defaults to None.

Returns:

The value of the option.

Return type:

Any

set(section, option, value)#

Set the value of an option in a section.

Parameters:
  • section (str) – The section of the option.

  • option (str) – The name of the option.

  • value (Any) – The value of the option.

Return type:

None

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.

Parameters:
  • section (str) – The section of the option.

  • option (str) – The name of the option.

Return type:

None

set_defaults()#

Apply defaults to the in-memory configuration and save.

Iterates over all section -> {option: value} pairs in defaults, creates any missing sections, sets each option, then calls save() once to persist the full configuration. Called automatically by __init__() when defaults is provided and no configuration file was found on disk.

Return type:

None

valkyrie_tools.constants#

valkyrie_tools.dns#

valkyrie_tools.dnscheck#

valkyrie_tools.exceptions#

valkyrie_tools.files#

valkyrie_tools.httpr#

valkyrie_tools.ipaddr#

valkyrie_tools.ipcheck#

valkyrie_tools.logger#

valkyrie_tools.urlcheck#

valkyrie_tools.valkyrie (module)#

valkyrie_tools.whobe#

valkyrie_tools.whois#