ofxclient.config.SecurableConfigParser

class ofxclient.config.SecurableConfigParser(keyring_name='ofxclient', keyring_available=True, **kwargs)[source]

ConfigParser subclass that knows how to store options marked as secure into the OS specific keyring/keychain.

To mark an option as secure, the caller must call ‘set_secure’ at least one time for the particular option and from then on it will be seen as secure and will be stored / retrieved from the keychain.

Example:

from ofxclient.config import SecurableConfigParser

# password will not be saved in the config file

c = SecurableConfigParser()
c.add_section('Info')
c.set('Info','username','bill')
c.set_secure('Info','password','s3cre7')
with open('config.ini','wb') as fp:
  c.write(fp)
__init__(keyring_name='ofxclient', keyring_available=True, **kwargs)[source]

Methods

__init__([keyring_name, keyring_available])
add_section(section) Create a new section in the configuration.
defaults()
get(section, option, *args) Get option value from section.
getboolean(section, option, *[, raw, vars, ...])
getfloat(section, option, *[, raw, vars, ...])
getint(section, option, *[, raw, vars, fallback])
has_option(section, option) Check for the existence of a given option in a given section.
has_section(section) Indicate whether the named section is present in the configuration.
has_secure_option(section, option) See is_secure_option
is_secure_option(section, option) Test an option to see if it is secured or not.
items(section) Get all items for a section.
options(section) Return a list of option names for the given section name.
optionxform(optionstr)
read(filenames[, encoding]) Read and parse a filename or a list of filenames.
readfp(fp[, filename]) Deprecated, use read_file instead.
remove_option(section, option) Removes the option from ConfigParser as well as
remove_section(section) Remove a file section.
sections() Return a list of section names, excluding [DEFAULT]
secure_items(section) Like items() but only return secure items.
set(section, option, value) Set an option value.
set_secure(section, option, value) Set an option and mark it as secure.
write(*args) See ConfigParser.write().

Attributes

OPTCRE
OPTCRE_NV
SECTCRE