File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515from __future__ import print_function
16- import json
1716from googleapiclient import errors
1817
1918
@@ -38,7 +37,7 @@ def create_course(self):
3837 'courseState' : 'PROVISIONED'
3938 }
4039 course = service .courses ().create (body = course ).execute ()
41- print ('Course created: %s, %s' % (course .get ('name' ), course .get ('id' )))
40+ print ('Course created: %s %s' % (course .get ('name' ), course .get ('id' )))
4241 # [END classroom_create_course]
4342 return course
4443
@@ -180,12 +179,10 @@ def add_student(self, course_id):
180179 % (student .get ('profile' ).get ('name' ).get ('fullName' ),
181180 course_id ))
182181 except errors .HttpError as error :
183- error = json .loads (error .content ).get ('error' )
184- if error .get ('code' ) == 409 :
185- print ('You are already a member of this course.' )
186- else :
187- raise
182+ print ('You are already a member of this course.' )
188183 # [END classroom_add_student]
184+ return error
185+ return student
189186
190187 def create_coursework (self , course_id ):
191188 """ Creates a coursework. """
You can’t perform that action at this time.
0 commit comments