class documentation

class msiempy.NitroConfig(configparser.ConfigParser): (source)

View In Hierarchy

configparser.ConfigParser parser object.

Handles the configuration. Reads the config file .msiem/conf.ini and make accessible it's values throught object properties.

Default configuration file should look like this. Authentication is left empty:

[esm]
host =
user =
passwd =

[general]
verbose = False
quiet = False
logfile =
timeout = 60
ssl_verify = False
It automatically look for the configuration file in the following places:
  • For Windows: %APPDATA%.msiemconf.ini
  • For Mac : $HOME/.msiem/conf.ini
  • For Linux : $XDG_CONFIG_HOME/.msiem/conf.ini or : $HOME/.msiem/conf.ini
  • If .msiem folder exists in your current directory : ./.msiem/conf.ini (Unix only)

You can setup the configuration by command line with msiempy_setup.py script.

Method __init__ Create the configuration parser
Class Variable CONFIG_FILE_NAME .msiem/conf.ini
Class Variable CONF_DIR .msiem/
Class Variable DEFAULT_CONF_DICT Default configuration values.
Method __str__ Custom str() method that lists all config fields.
Method write Write the config file to the predetermined path.
Method iset Interactively set the specified section/option by asking the user the input.
Method user Config value section "esm" optiom "user"
Method host Config section "esm" option "host"
Method passwd Config value section "esm" option "passwd"
Method verbose Config value section "general" option "verbose"
Method quiet Config value section "general" option "quiet"
Method logfile Config value section "general" option "logfile"
Method timeout Config value section "general" option "timeout"
Method ssl_verify Config value section "general" option "ssl_verify"
Static Method find_ini_location No summary
Instance Variable _path Undocumented
Method _iset Internal method to interactively set a option in a section.
def __init__(self, *arg, path=None, config=None, **kwarg): (source)

Create the configuration parser

Arguments:
  • path: Config file special path, if path is left None, will automatically look for it.
  • config: Manual config dict. ex: {'general':{'verbose':True}}.
  • *args, **kwargs : Passed to configparser.ConfigParser.__init__() method.
_path = (source)
Undocumented
CONFIG_FILE_NAME = (source)
.msiem/conf.ini
(type: str)
CONF_DIR = (source)
.msiem/
(type: str)
DEFAULT_CONF_DICT = (source)
Default configuration values.
(type: Dict)
def __str__(self): (source)
Custom str() method that lists all config fields.
def write(self): (source)
Write the config file to the predetermined path.
def _iset(self, section, option, secure=(False)): (source)
Internal method to interactively set a option in a section.
def iset(self, section, option=None, secure=(False)): (source)

Interactively set the specified section/option by asking the user the input.

Arguments:
  • section (str): Configuration's section. Exemple : 'esm' or 'general'.
  • option (bool): Configuraion's option. Leave to None to set the whole section one after another. Exemple : 'user', 'timeout'.
  • secure (bool): Will use getpass to retreive the configuration value and won't print old value.
@property
def user(self): (source)
Config value section "esm" optiom "user"
@property
def host(self): (source)
Config section "esm" option "host"
@property
def passwd(self): (source)
Config value section "esm" option "passwd"
@property
def verbose(self): (source)
Config value section "general" option "verbose"
@property
def quiet(self): (source)
Config value section "general" option "quiet"
@property
def logfile(self): (source)
Config value section "general" option "logfile"
@property
def timeout(self): (source)
Config value section "general" option "timeout"
@property
def ssl_verify(self): (source)
Config value section "general" option "ssl_verify"
@staticmethod
def find_ini_location(): (source)
Returns the location of a supposed conf.ini file the conf.ini file. If .msiem folder exists in you local directory, assume the conf.ini file is in there. If the file doesn't exist, will still return the location. Do not create a file nor directory, you must call msiempy.core.config.NitroConfig.write.
API Documentation for msiempy, generated by pydoctor 20.7.1 at 2020-11-18 14:02:21.