firebase_admin/_user_mgt.py
def import_users(self, users, hash_alg=None):
        """Imports the given list of users to Firebase Auth."""
        try:
            if not users or len(users) > MAX_IMPORT_USERS_SIZE:
                raise ValueError(
                    'Users must be a non-empty list with no more than {0} elements.'.format(
                        MAX_IMPORT_USERS_SIZE))
            if any([not isinstance(u, _user_import.ImportUserRecord) for u in users]):
                raise ValueError('One or more user objects are invalid.')
        except TypeError:
            raise ValueError('users must be iterable')

        payload = {'users': [u.to_dict() for u in users]}
        if any(['passwordHash' in u for u in payload['users']]):
            if not isinstance(hash_alg, _user_import.UserImportHash):
                raise ValueError('A UserImportHash is required to import users with passwords.')
            payload.update(hash_alg.to_dict())
        try:
            body, http_resp = self._client.body_and_response(
                'post', '/accounts:batchCreate', json=payload)
        except requests.exceptions.RequestException as error:
            raise _auth_utils.handle_auth_backend_error(error)
        else:
            if not isinstance(body, dict):
                raise _auth_utils.UnexpectedResponseError(
                    'Failed to import users.', http_response=http_resp)
            return body
Imports the given list of users to Firebase Auth.
Imports the given list of users to Firebase Auth.
Imports the given list of users to Firebase Auth .
def import_users(self, users, hash_alg=None):
        try:
            if not users or len(users) > MAX_IMPORT_USERS_SIZE:
                raise ValueError(
                    'Users must be a non-empty list with no more than {0} elements.'.format(
                        MAX_IMPORT_USERS_SIZE))
            if any([not isinstance(u, _user_import.ImportUserRecord) for u in users]):
                raise ValueError('One or more user objects are invalid.')
        except TypeError:
            raise ValueError('users must be iterable')
        payload = {'users': [u.to_dict() for u in users]}
        if any(['passwordHash' in u for u in payload['users']]):
            if not isinstance(hash_alg, _user_import.UserImportHash):
                raise ValueError('A UserImportHash is required to import users with passwords.')
            payload.update(hash_alg.to_dict())
        try:
            body, http_resp = self._client.body_and_response(
                'post', '/accounts:batchCreate', json=payload)
        except requests.exceptions.RequestException as error:
            raise _auth_utils.handle_auth_backend_error(error)
        else:
            if not isinstance(body, dict):
                raise _auth_utils.UnexpectedResponseError(
                    'Failed to import users.', http_response=http_resp)
            return body
def import_users ( self , users , hash_alg = None ) : try : if not users or len ( users ) > MAX_IMPORT_USERS_SIZE : raise ValueError ( 'Users must be a non-empty list with no more than {0} elements.' . format ( MAX_IMPORT_USERS_SIZE ) ) if any ( [ not isinstance ( u , _user_import . ImportUserRecord ) for u in users ] ) : raise ValueError ( 'One or more user objects are invalid.' ) except TypeError : raise ValueError ( 'users must be iterable' ) payload = { 'users' : [ u . to_dict ( ) for u in users ] } if any ( [ 'passwordHash' in u for u in payload [ 'users' ] ] ) : if not isinstance ( hash_alg , _user_import . UserImportHash ) : raise ValueError ( 'A UserImportHash is required to import users with passwords.' ) payload . update ( hash_alg . to_dict ( ) ) try : body , http_resp = self . _client . body_and_response ( 'post' , '/accounts:batchCreate' , json = payload ) except requests . exceptions . RequestException as error : raise _auth_utils . handle_auth_backend_error ( error ) else : if not isinstance ( body , dict ) : raise _auth_utils . UnexpectedResponseError ( 'Failed to import users.' , http_response = http_resp ) return body
Imports the given list of users to Firebase Auth.
Imports the given list of users to Firebase Auth .
"""Imports the given list of users to Firebase Auth."""
self
users
hash_alg