-
Notifications
You must be signed in to change notification settings - Fork 0
/
swotsquiz.py
45 lines (36 loc) · 1.11 KB
/
swotsquiz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
Python SDK for myswots.com api
'''
import swotsquestion
# Swots quiz class.
# User should not create object of this class directly.
# Object of this class should be created by MySwots.createQuiz or MySwots.loadQuiz
class SwotsQuiz:
# Constructor
def __init__(self, quizDict, swots):
self._quiz = quizDict
self._swots = swots
# userId
@property
def userId(self):
return self._swots.userId
# testId (quizId)
@property
def testId(self):
return self._quiz["testId"]
# questionId
@property
def questionIds(self):
return [q["questionId"] for q in self._quiz["questionsMetadata"]]
# Load one question
def loadQuestion(self, questionId):
qDict = self._swots.getJson("quiz/users/" + str(self.userId)
+ "/tests/" + str(self.testId)
+ "/question/" + str(questionId))
return swotsquestion.SwotsQuestion(self, questionId, qDict)
# Get status for one question
def getQuestionStatus(self, questionId):
pass
# Get result for this test
def getResult(self):
pass