Skip to content

Commit f7b824f

Browse files
Fix handling of missing config when passing in email and token.
1 parent aeff51b commit f7b824f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

CloudFlare/read_configs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,35 @@ 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'))
2726
except ConfigParser.NoOptionError:
2827
email = None
28+
except ConfigParser.NoSectionError:
29+
email = None
2930

3031
if token is None:
3132
try:
3233
token = re.sub(r"\s+", '', config.get('CloudFlare', 'token'))
3334
except ConfigParser.NoOptionError:
3435
token = None
36+
except ConfigParser.NoSectionError:
37+
token = None
3538

3639
if certtoken is None:
3740
try:
3841
certtoken = re.sub(r"\s+", '', config.get('CloudFlare', 'certtoken'))
3942
except ConfigParser.NoOptionError:
4043
certtoken = None
44+
except ConfigParser.NoSectionError:
45+
certtoken = None
4146

4247
try:
4348
extras = re.sub(r"\s+", ' ', config.get('CloudFlare', 'extras'))
4449
except ConfigParser.NoOptionError:
4550
extras = None
51+
except ConfigParser.NoSectionError:
52+
extras = None
4653

4754
if extras:
4855
extras = extras.split(' ')

0 commit comments

Comments
 (0)