More API for examination
parent
f7404bb6e1
commit
881c3a451d
|
@ -314,7 +314,13 @@ class CakeCMS:
|
|||
return self.get_exams_api('exams', course=course).json()
|
||||
|
||||
def exam_solutions_index(self, exam_id, course=None):
|
||||
return self.get_exams_api('solutions/'+str(exam_id), course=course).json()
|
||||
return self.get_exams_api('solutions/list/'+str(exam_id), course=course).json()
|
||||
|
||||
def exam_solutions_get_all(self, exam_id, course=None):
|
||||
return self.get_exams_api('solutions/download/'+str(exam_id), course=course).json()
|
||||
|
||||
def exam_solutions_get(self, solution_id, course=None):
|
||||
return self.get_exams_api('solution/get/' + str(solution_id), course=course).json()
|
||||
|
||||
def exam_solution_download_file(self, downloadname, course=None):
|
||||
return self.get_exams_api('files/' + (course if course else self.course) + '/solution/' + downloadname, course=course)
|
||||
|
|
|
@ -25,3 +25,11 @@ for solution in solutions['solutionList']:
|
|||
print('-'*80)
|
||||
print('#'+str(solution['id'])+': ', json.dumps(content['data'], indent=4))
|
||||
|
||||
# Or: get all at once:
|
||||
print('='*80)
|
||||
all_solutions = cms.exam_solutions_get_all(exam_id)
|
||||
print(json.dumps(all_solutions, indent=4))
|
||||
|
||||
## How to retrieve uploaded files:
|
||||
#x = cms.exam_solution_download_file('668aae926f91f95177d90ecba0cbf924a301e73934f4a827760384fed868621e.pdf')
|
||||
#print(repr(x), x.content[:10])
|
||||
|
|
Loading…
Reference in New Issue