in UserProfile_function.py [0:0]
def delete_user_profile(domain_id, user_profile_name):
response = client.delete_user_profile(
DomainId=domain_id,
UserProfileName=user_profile_name
)
deleted = False
while not deleted:
try:
client.describe_user_profile(DomainId=domain_id, UserProfileName=user_profile_name)
except ClientError as error:
if error.response['Error']['Code'] == 'ResourceNotFound':
print('Deleted')
deleted = True
return
time.sleep(5)
return response