Jelajahi Sumber

修改alexa请求pushtool返回对象_2

locky 4 tahun lalu
induk
melakukan
b940d6e85c
1 mengubah file dengan 5 tambahan dan 11 penghapusan
  1. 5 11
      Controller/AlexaController.py

+ 5 - 11
Controller/AlexaController.py

@@ -1,16 +1,10 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-import datetime
-import json
-import random
 import subprocess
+
 from django.views import View
+from django.http import HttpResponse
 from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 
-from AnsjerUIDManage.config import SALES, ONLINE_DEVICE
-from Object.ResponseObject import ResponseObject
-
 
 class PushCommandView(View):
 
@@ -29,11 +23,11 @@ class PushCommandView(View):
     def PushCommand(self, request_dict):
         command = request_dict.get('command', None)
         if not command:
-            return repr(444)
+            return HttpResponse(444)
         try:
             back = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE). \
                                     communicate(timeout=2)
-            return repr(back)
+            return HttpResponse(back)
         except Exception as e:
-            return repr(e)
+            return HttpResponse(e)