zinoubm's picture
integrating twitter chatbot to a django server
bcd324a
raw
history blame
392 Bytes
from rest_framework.views import APIView
from django.http import JsonResponse
from TwitterChatBot.main import ask
class AskChatBot(APIView):
"""
let you ask a question to the twitter chatbot
"""
def get(self, request, format=None):
question = request.data["question"]
answer = ask(question=question)
return JsonResponse({"answer": answer.strip()})