linkcheck.configuration

Store metadata and options.

Functions

get_certifi_file()

Get the SSL certifications installed by the certifi package.

get_modules_info()

Return unicode string with detected module info.

get_plugin_folders()

Get linkchecker plugin folders.

get_system_cert_file()

Try to find a system-wide SSL certificate file.

get_user_config()

Get the user configuration filename.

get_user_data()

Get the user data folder.

make_userdir(child)

Create a child directory.

normpath(path)

Norm given system path with all available norm or expand functions in os.path.

split_hosts(value)

Split comma-separated host list.

Classes

Configuration()

Storage for configuration options.

class linkcheck.configuration.Configuration[source]

Bases: dict

Storage for configuration options. Options can both be given from the command line as well as from configuration files.

Initialize the default options.

add_auth(user=None, password=None, pattern=None)[source]

Add given authentication data.

get_connectionlimits()[source]

Get dict with limit per connection type.

get_user_password(url)[source]

Get tuple (user, password) from configured authentication that matches the given URL. Both user and password can be None if not specified, or no authentication matches the given URL.

logger_add(loggerclass)[source]

Add a new logger type to the known loggers.

logger_new(loggername, **kwargs)[source]

Instantiate new logger and return it.

read(files=None)[source]

Read settings from given config files.

Raises:

LinkCheckerError on syntax errors in the config file(s)

sanitize()[source]

Make sure the configuration is consistent.

sanitize_logger()[source]

Make logger configuration consistent.

sanitize_loginurl()[source]

Make login configuration consistent.

sanitize_plugins()[source]

Ensure each plugin is configurable.

sanitize_ssl()[source]

Use local installed certificate file if available. Tries to get system, then certifi certificate file.

set_status_logger(status_logger)[source]

Set the status logger.

linkcheck.configuration.get_certifi_file()[source]

Get the SSL certifications installed by the certifi package.

Returns:

the filename to the cert file

Return type:

string

Raises:

ImportError when certifi is not installed or ValueError when the file is not found

linkcheck.configuration.get_modules_info()[source]

Return unicode string with detected module info.

linkcheck.configuration.get_plugin_folders()[source]

Get linkchecker plugin folders. Default is “$XDG_DATA_HOME/linkchecker/plugins/” if $XDG_DATA_HOME is set, else “~/.local/share/linkchecker/plugins/”. “~/.linkchecker/plugins/” is also supported for backwards compatibility, and is used if it exists.

linkcheck.configuration.get_system_cert_file()[source]

Try to find a system-wide SSL certificate file. :return: the filename to the cert file :raises: ValueError when no system cert file could be found

linkcheck.configuration.get_user_config()[source]

Get the user configuration filename. If the user configuration file does not exist, copy it from the initial configuration file. Returns path to user config file (which might not exist due to copy failures). :return configuration filename :rtype string

linkcheck.configuration.get_user_data()[source]

Get the user data folder. Returns “~/.linkchecker/” if this folder exists, “$XDG_DATA_HOME/linkchecker” if $XDG_DATA_HOME is set, else “~/.local/share/linkchecker”. :rtype string

linkcheck.configuration.make_userdir(child)[source]

Create a child directory.

linkcheck.configuration.normpath(path)[source]

Norm given system path with all available norm or expand functions in os.path.

linkcheck.configuration.split_hosts(value)[source]

Split comma-separated host list.

Modules

confparse

Parse configuration files