Urgent help needed: API

Hi,
I want to get the following dataframe:
Screenshot 2023-01-16 11.30.46 AM

this is my code:

def extract_attendances(id_list):
    liste_all=[]
    
    for ID in id_list:
        resp=requests.get(("https://examen-api.s3.eu-west-1.amazonaws.com/Attendance/{}").format(ID)).json()
        dico={}
        dico['StudentID']=resp['StudentID']
                     
        for dic in resp['StudentAttendance']:
           
            dico['CourseID']=list(dic.keys())[0]
           
            dico['Date']= list(dic.values())[0]
    liste_all.append(dico)
    attendance=pd.DataFrame(liste_all)
    return attendance

extract_attendances(id_list)

And I only get the last line of the dataframe with it.

Can anyone help me with this please?

liste_all.append(dico) is on the wrong indentation level.