How to use the dnsimple.dnsimple.DNSimpleTokenAuth function in dnsimple

To help you get started, we’ve selected a few dnsimple examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onlyhavecans / dnsimple-python / dnsimple / dnsimple.py View on Github external
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.')