def create(self, password, username, realm=None):
        """ Creates a storage password.

        A `StoragePassword` can be identified by <username>, or by <realm>:<username> if the
        optional realm parameter is also provided.

        :param password: The password for the credentials - this is the only part of the credentials that will be stored securely.
        :type name: ``string``
        :param username: The username for the credentials.
        :type name: ``string``
        :param realm: The credential realm. (optional)
        :type name: ``string``

        :return: The :class:`StoragePassword` object created.
        """
        if not isinstance(username, basestring):
            raise ValueError("Invalid name: %s" % repr(username))

        if realm is None:
            response = self.post(password=password, name=username)
        else:
            response = self.post(password=password, realm=realm, name=username)

        if response.status != 201:
            raise ValueError("Unexpected status code %s returned from creating a stanza" % response.status)

        entries = _load_atom_entries(response)
        state = _parse_atom_entry(entries[0])
        storage_password = StoragePassword(self.service, self._entity_path(state), state=state, skip_refresh=True)

        return storage_password
def create ( self , password , username , realm = None ) : if not isinstance ( username , basestring ) : raise ValueError ( "Invalid name: %s" % repr ( username ) ) if realm is None : response = self . post ( password = password , name = username ) else : response = self . post ( password = password , realm = realm , name = username ) if response . status != 201 : raise ValueError ( "Unexpected status code %s returned from creating a stanza" % response . status ) entries = _load_atom_entries ( response ) state = _parse_atom_entry ( entries [ 0 ] ) storage_password = StoragePassword ( self . service , self . _entity_path ( state ) , state = state , skip_refresh = True ) return storage_password
Creates a storage password.

        A `StoragePassword` can be identified by <username>, or by <realm>:<username> if the
        optional realm parameter is also provided.

        :param password: The password for the credentials - this is the only part of the credentials that will be stored securely.
        :type name: ``string``
        :param username: The username for the credentials.
        :type name: ``string``
        :param realm: The credential realm. (optional)
        :type name: ``string``

        :return: The :class:`StoragePassword` object created.