@require_GET
@ensure_valid_course_key
def get_course_lti_endpoints(request, course_id):
 course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 try:
  course = get_course(course_key, depth=2)
 except ValueError:
  return HttpResponse(status=404)
 anonymous_user = AnonymousUser()
 anonymous_user.known = False
 lti_descriptors = modulestore().get_items(course.id, qualifiers={'category': 'lti'})
 lti_noauth_modules = [get_module_for_descriptor(anonymous_user, request, descriptor, FieldDataCache.cache_for_descriptor_descendents(course_key, anonymous_user, descriptor), course_key, course=course) for descriptor in lti_descriptors]
 endpoints = [{'display_name': module.display_name, 'lti_2_0_result_service_json_endpoint': (module.get_outcome_service_url(service_name='lti_2_0_result_rest_handler') + '/user/{anon_user_id}'), 'lti_1_1_result_service_xml_endpoint': module.get_outcome_service_url(service_name='grade_handler')} for module in lti_noauth_modules]
 return HttpResponse(json.dumps(endpoints), content_type='application/json')

@ require_GET @ ensure_valid_course_key def get_course_lti_endpoints ( request , course_id ) : course_key = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) try : course = get_course ( course_key , depth = 2 ) except ValueError : return HttpResponse ( status = 404 ) anonymous_user = AnonymousUser ( ) anonymous_user . known = False lti_descriptors = modulestore ( ) . get_items ( course . id , qualifiers = { 'category' : 'lti' } ) lti_noauth_modules = [ get_module_for_descriptor ( anonymous_user , request , descriptor , FieldDataCache . cache_for_descriptor_descendents ( course_key , anonymous_user , descriptor ) , course_key , course = course ) for descriptor in lti_descriptors ] endpoints = [ { 'display_name' : module . display_name , 'lti_2_0_result_service_json_endpoint' : ( module . get_outcome_service_url ( service_name = 'lti_2_0_result_rest_handler' ) + '/user/{anon_user_id}' ) , 'lti_1_1_result_service_xml_endpoint' : module . get_outcome_service_url ( service_name = 'grade_handler' ) } for module in lti_noauth_modules ] return HttpResponse ( json . dumps ( endpoints ) , content_type = 'application/json' )
view that .