|
@@ -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)
|
|
|
|