Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 6272de8

Browse files
authored
Fix fail parse config if no section
1 parent aeff51b commit 6272de8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

CloudFlare/read_configs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,26 @@ def read_configs():
2121
])
2222

2323
if email is None:
24-
email = config.get('CloudFlare', 'email')
2524
try:
2625
email = re.sub(r"\s+", '', config.get('CloudFlare', 'email'))
27-
except ConfigParser.NoOptionError:
26+
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
2827
email = None
2928

3029
if token is None:
3130
try:
3231
token = re.sub(r"\s+", '', config.get('CloudFlare', 'token'))
33-
except ConfigParser.NoOptionError:
32+
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
3433
token = None
3534

3635
if certtoken is None:
3736
try:
3837
certtoken = re.sub(r"\s+", '', config.get('CloudFlare', 'certtoken'))
39-
except ConfigParser.NoOptionError:
38+
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
4039
certtoken = None
4140

4241
try:
4342
extras = re.sub(r"\s+", ' ', config.get('CloudFlare', 'extras'))
44-
except ConfigParser.NoOptionError:
43+
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
4544
extras = None
4645

4746
if extras:

0 commit comments

Comments
 (0)