Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for cfg in ['.dnsimple', os.path.expanduser('~/.dnsimple')]:
if os.path.exists(cfg):
config.read(cfg)
break
try:
email = config.get('DNSimple', 'email')
password = config.get('DNSimple', 'password')
api_token = config.get('DNSimple', 'api_token')
account_id = config.get('DNSimple', 'account_id')
except configparser.NoSectionError:
pass
self.user_account_id = account_id
if api_token is not None:
self._auth = DNSimpleTokenAuth(api_token)
else:
if email is not None and password is not None:
self._auth = HTTPBasicAuth(email, password)
else:
raise DNSimpleAuthException('insufficient authentication details provided.')