From 6272de825eb8d85acb0bf9459b49cc8dadd9e8b8 Mon Sep 17 00:00:00 2001 From: Adam Dobrawy Date: Mon, 4 Jul 2016 12:20:41 +0200 Subject: [PATCH] Fix fail parse config if no section --- CloudFlare/read_configs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CloudFlare/read_configs.py b/CloudFlare/read_configs.py index 33ec61c..3dd1ec4 100644 --- a/CloudFlare/read_configs.py +++ b/CloudFlare/read_configs.py @@ -21,27 +21,26 @@ def read_configs(): ]) if email is None: - email = config.get('CloudFlare', 'email') try: email = re.sub(r"\s+", '', config.get('CloudFlare', 'email')) - except ConfigParser.NoOptionError: + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): email = None if token is None: try: token = re.sub(r"\s+", '', config.get('CloudFlare', 'token')) - except ConfigParser.NoOptionError: + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): token = None if certtoken is None: try: certtoken = re.sub(r"\s+", '', config.get('CloudFlare', 'certtoken')) - except ConfigParser.NoOptionError: + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): certtoken = None try: extras = re.sub(r"\s+", ' ', config.get('CloudFlare', 'extras')) - except ConfigParser.NoOptionError: + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): extras = None if extras: