Эх сурвалжийг харах

修改reqSendRtspMsg函数

locky 4 жил өмнө
parent
commit
ae837cc49b
1 өөрчлөгдсөн 5 нэмэгдсэн , 6 устгасан
  1. 5 6
      controller/index.py

+ 5 - 6
controller/index.py

@@ -217,6 +217,10 @@ def runSendRtspMsg_thread(UID, PWD, MSG):
         print("back1----", back[1].decode())  # back是一个元祖,可以通过元祖取值的方式获取结果
         return True
 
+def reqSendRtspMsg(self, url):
+    logger = logging.getLogger('django')
+    logger.info('--------请求接口--------')
+    requests.get(url=url)
 
 class oa2RtspStartView(TemplateView):
     def post(self, request, *args, **kwargs):
@@ -320,11 +324,6 @@ class oa2RtspStartView(TemplateView):
         print(res)
         return True
 
-    def reqSendRtspMsg(self, url):
-        logger = logging.getLogger('django')
-        logger.info('--------请求接口--------')
-        requests.get(url=url)
-
     # 触发此方法,让摄像头推流到MSG流地址
     def runSendRtspMsg(self, logger, region, command):
         if region == 'CN':
@@ -332,7 +331,7 @@ class oa2RtspStartView(TemplateView):
             url = "http://52.83.252.41:7880/alexa/command?command={command}".format(command=command)
             # 多线程请求国内服务器调用pushtool
             try:
-                threading.Thread(target=self.reqSendRtspMsg, args=(url)).start()
+                threading.Thread(target=reqSendRtspMsg, args=(url)).start()
             except Exception as e:
                 logger.info('异常: {}'.format(repr(e)))
         else: