linkcheck.configuration

Store metadata and options.

Functions

add_kde_proxy(key, value, data)

Add a proxy value to data dictionary after sanity checks.

add_kde_setting(key, value, data)

Add a KDE proxy setting value to data dictionary.

get_certifi_file()

Get the SSL certifications installed by the certifi package.

get_gnome_proxy([protocol])

Return host:port for a GNOME proxy if found, else None.

get_kde_config_dir()

Return KDE configuration directory or None if not found.

get_kde_ftp_proxy()

Return host:port for KDE HTTP proxy if found, else None.

get_kde_http_proxy()

Return host:port for KDE HTTP proxy if found, else None.

get_modules_info()

Return unicode string with detected module info.

get_plugin_folders()

Get linkchecker plugin folders.

get_share_dir()

Return absolute path of LinkChecker example configuration.

get_share_file(filename[, devel_dir])

Return a filename in the share directory.

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.

read_kioslaverc()

Read kioslaverc into data dictionary.

resolve_indirect(data, key[, splithosts])

Replace name of environment variable with its value.

resolve_kde_settings(data)

Write final proxy configuration values in data dictionary.

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_proxies()[source]

Try to read additional proxy settings which urllib does not support.

sanitize_ssl()[source]

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

set_status_logger(status_logger)[source]

Set the status logger.

linkcheck.configuration.add_kde_proxy(key, value, data)[source]

Add a proxy value to data dictionary after sanity checks.

linkcheck.configuration.add_kde_setting(key, value, data)[source]

Add a KDE proxy setting value to data dictionary.

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_gnome_proxy(protocol='HTTP')[source]

Return host:port for a GNOME proxy if found, else None.

linkcheck.configuration.get_kde_config_dir()[source]

Return KDE configuration directory or None if not found.

linkcheck.configuration.get_kde_ftp_proxy()[source]

Return host:port for KDE HTTP proxy if found, else None.

linkcheck.configuration.get_kde_http_proxy()[source]

Return host:port for KDE HTTP proxy if found, else None.

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/”. “~/.linkchecker/plugins/” is also supported for backwards compatibility, and is used if both directories exist.

linkcheck.configuration.get_share_dir()[source]

Return absolute path of LinkChecker example configuration.

linkcheck.configuration.get_share_file(filename, devel_dir=None)[source]

Return a filename in the share directory.

Parameters
  • devel_dir (string) – directory to search when developing

  • filename (string) – filename to search for

Returns

the found filename or None

Return type

string

Raises

ValueError if not found

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, but only if this is not a portable installation. Returns path to user config file (which might not exist due to copy failures or on portable systems). :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 it does not. :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.read_kioslaverc()[source]

Read kioslaverc into data dictionary.

linkcheck.configuration.resolve_indirect(data, key, splithosts=False)[source]

Replace name of environment variable with its value.

linkcheck.configuration.resolve_kde_settings(data)[source]

Write final proxy configuration values in data dictionary.

linkcheck.configuration.split_hosts(value)[source]

Split comma-separated host list.

Modules

linkcheck.configuration.confparse

Parse configuration files