瀏覽代碼

new file: handlers/sending_message.py

stucked_s 5 月之前
父節點
當前提交
1e0c2d7a85
共有 1 個文件被更改,包括 29 次插入0 次删除
  1. 29 0
      handlers/sending_message.py

+ 29 - 0
handlers/sending_message.py

@@ -0,0 +1,29 @@
+import requests
+import xmpp
+from xmpp import cli
+import config
+from BotClass import JabberBot
+import json
+#раскомментировать, когда перейдем на разные пароли
+import hashlib
+from datetime import datetime
+import time
+import threading
+#test
+import jsonAndRequest as jsreq
+global tasklist
+botname="open_servicerequest_booked"
+operating_status=211
+JID=botname+"@"+config.JSERVER
+PORT=config.PORT
+
+PASSWORD=hashlib.md5((botname+config.PASSWORD).encode('utf-8')).hexdigest()
+
+proceed_to=["open_servicerequest_booked@ej.sharix-app.org"]
+
+token = jsreq.requestGetToken(botname, PASSWORD, config.API_URL+"/api/v1/auth/token/login/")
+
+bot = JabberBot(JID, PASSWORD, PORT)
+
+def send_msg(msg):
+    bot.send_notification(msg)