Example #1
0
    def __init__(self, parsed_attributes=None):
        """Initializes the Authenticator with the attributes in the attributes
        parsed from a %spark magic command if applicable, or with default values
        otherwise.

        Args:
            self,
            parsed_attributes (IPython.core.magics.namespace): The namespace object that
            is created from parsing %spark magic command.
        """
        if parsed_attributes is not None:
            if parsed_attributes.user == '' or parsed_attributes.password == '':
                new_exc = BadUserDataException("Need to supply username and password arguments for "\
                    "Basic Access Authentication. (e.g. -a username -p password).")
                raise new_exc
            self.username = parsed_attributes.user
            self.password = parsed_attributes.password
        else:
            self.username = '******'
            self.password = '******'
        HTTPBasicAuth.__init__(self, self.username, self.password)
        Authenticator.__init__(self, parsed_attributes)
Example #2
0
 def __init__(self, username, password):
     HTTPBasicAuth.__init__(self, username, password)