From 2c4ee603f53aab555aba764ad95b65bf2da012f1 Mon Sep 17 00:00:00 2001 From: Martin Levy Date: Wed, 30 Mar 2022 15:29:45 -0700 Subject: [PATCH] config file processing was messed up --- CloudFlare/cloudflare.py | 19 +++++++++++-------- CloudFlare/read_configs.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CloudFlare/cloudflare.py b/CloudFlare/cloudflare.py index f0af3d9..188d3c5 100644 --- a/CloudFlare/cloudflare.py +++ b/CloudFlare/cloudflare.py @@ -49,14 +49,17 @@ def __init__(self, config): self.network = CFnetwork(use_sessions=self.use_sessions) self.user_agent = user_agent() - if not isinstance(self.email, str): - raise ValueError('email argument not string') - if not isinstance(self.token, str): - raise ValueError('token argument not string') - if not isinstance(self.certtoken, str): - raise ValueError('certtoken argument not string') - if not isinstance(self.base_url, str): - raise ValueError('base url argument not string') + ## We don't need to check this here as we test for + ## this when building the authentication headers + ## + ##if not isinstance(self.email, str): + ## raise ValueError('email argument not string') + ##if not isinstance(self.token, str): + ## raise ValueError('token argument not string') + ##if not isinstance(self.certtoken, str): + ## raise ValueError('certtoken argument not string') + ##if not isinstance(self.base_url, str): + ## raise ValueError('base url argument not string') if 'debug' in config and config['debug']: self.logger = CFlogger(config['debug']).getLogger() diff --git a/CloudFlare/read_configs.py b/CloudFlare/read_configs.py index 41834fb..653c63a 100644 --- a/CloudFlare/read_configs.py +++ b/CloudFlare/read_configs.py @@ -16,7 +16,7 @@ def read_configs(profile=None): # envioronment variables override config files - so setup first config['email'] = os.getenv('CLOUDFLARE_EMAIL') if os.getenv('CLOUDFLARE_EMAIL') != None else os.getenv('CF_API_EMAIL') config['token'] = os.getenv('CLOUDFLARE_API_KEY') if os.getenv('CLOUDFLARE_API_KEY') != None else os.getenv('CF_API_KEY') - config['certtoken'] = os.getenv('CLOUDFLARE_API_CERTKEY') if os.getenv('CLOUDFLARE_API_CERTKEY') != None else os.getenv('CF_API_CERTKEY') + config['certtoken'] = os.getenv('CLOUDFLARE_API_CERTKEY') if os.getenv('CLOUDFLARE_API_CERTKEY') != None else os.getenv('CF_API_CERTKEY') config['extras'] = os.getenv('CLOUDFLARE_API_EXTRAS') if os.getenv('CLOUDFLARE_API_EXTRAS') != None else os.getenv('CF_API_EXTRAS') config['base_url'] = os.getenv('CLOUDFLARE_API_URL') if os.getenv('CLOUDFLARE_API_URL') != None else os.getenv('CF_API_URL') if profile is None: