我有以下代码,它只能工作一半。我想要做的是
在数据库上保存(studentID,tutorID,sessionID)。
伪代码
GENREATE SESSION_ID
SAVE (SESSION_ID, STUDENTID, TUTORID)
RETURN SESSION_ID AS RESPONSE
Views.py
@api_view(['GET', 'POST'])
def startCall(request, studentID, tutorID):
if request.method == 'POST':
API_KEY = 'APIKEY'
API_SECRET = 'API_SECRET'
OTSDK = OpenTokSDK.OpenTokSDK(API_KEY,API_SECRET)
session_id = OTSDK.create_session().session_id
response = {}
response['session_id'] = str(session_id)
return Response(response)
serializers.py
class startCallSerializer(serializers.ModelSerializer):
class Meta:
model = call
fields = ('tutor', 'billed', 'billed_status',
'tutor_status', 'sid', 'started', 'finished')