How to use the function in configparser

To help you get started, we’ve selected a few configparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arista-eosplus / pyeapi / pyeapi / View on Github external
def read(self, filename):
        """Reads the file specified by filename

        This method will load the eapi.conf file specified by filename into
        the instance object.  It will also add the default connection localhost
        if it was not defined in the eapi.conf file

            filename (str): The full path to the file to load

  , filename)
        except SafeConfigParserError as exc:
            # Ignore file and syslog a message on SafeConfigParser errors
            msg = ("%s: parsing error in eapi conf file: %s" %
                   (type(exc).__name__, filename))


        for name in self.sections():
            if name.startswith('connection:') and \
               'host' not in dict(self.items(name)):

                self.set(name, 'host', name.split(':')[1])
github fail2ban / fail2ban / fail2ban / client / View on Github external
def read(self, filenames):
		fileNamesFull = []
		if not isinstance(filenames, list):
			filenames = [ filenames ]
		for filename in filenames:
			fileNamesFull += SafeConfigParserWithIncludes.getIncludes(filename)
		logSys.debug("Reading files: %s" % fileNamesFull)
		if sys.version_info >= (3,2): # pragma: no cover
			return, fileNamesFull, encoding='utf-8')
			return, fileNamesFull)
github AudiusProject / audius-protocol / discovery-provider / src / utils / View on Github external
def read(self, filenames, encoding=None):
        """Overridden read() method to call parse_flask_section() at the end"""
        ret =, filenames, encoding)
        return ret
github nthmost / python-secureconfig / secureconfig / View on Github external
def read(self, filenames):
        """Read the list of config files."""
        # print("[DEBUG] filenames: ", filenames), filenames)
github tehmaze / classified / classified / View on Github external
def read(self, filename):
        if isinstance(filename, (list, tuple)):
            self.filename = filename[0]
            self.filename = filename, filename)
github juantascon / tvcmd / tvcmd / View on Github external
def read(self):
        return, self.filename)