Skip to content

Commit

Permalink
Fix fail parse config if no section
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-m committed Jul 4, 2016
1 parent aeff51b commit 6272de8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions CloudFlare/read_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6272de8

Please sign in to comment.