File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,12 +50,10 @@ def get_course(self, course_id):
5050 course = service .courses ().get (id = course_id ).execute ()
5151 print ('Course "{%s}" found.' , course .get ('name' ))
5252 except errors .HttpError as error :
53- error = json .loads (error .content ).get ('error' )
54- if error .get ('code' ) == 404 :
55- print ('Course with ID "{%s}" not found.' , course_id )
56- else :
57- raise
53+ print ('Course with ID "{%s}" not found.' , course_id )
5854 # [END classroom_get_course]
55+ return error
56+ return course
5957
6058 def list_courses (self ):
6159 """ Lists all classroom courses. """
@@ -157,13 +155,11 @@ def add_teacher(self, course_id):
157155 % (teacher .get ('profile' ).get ('name' ).get ('fullName' ),
158156 course_id ))
159157 except errors .HttpError as error :
160- error = json .loads (error .content ).get ('error' )
161- if error .get ('code' ) == 409 :
162- print ('User "{%s}" is already a member of this course.'
163- % teacher_email )
164- else :
165- raise
158+ print ('User "{%s}" is already a member of this course.'
159+ % teacher_email )
166160 # [END classroom_add_teacher]
161+ return error
162+ return teachers
167163
168164 def add_student (self , course_id ):
169165 """ Adds a student to a course. """
You can’t perform that action at this time.
0 commit comments