sending_message.py 756 B

1234567891011121314151617181920212223242526272829
  1. import requests
  2. import xmpp
  3. from xmpp import cli
  4. import config
  5. from BotClass import JabberBot
  6. import json
  7. #раскомментировать, когда перейдем на разные пароли
  8. import hashlib
  9. from datetime import datetime
  10. import time
  11. import threading
  12. #test
  13. import jsonAndRequest as jsreq
  14. global tasklist
  15. botname="open_servicerequest_booked"
  16. operating_status=211
  17. JID=botname+"@"+config.JSERVER
  18. PORT=config.PORT
  19. PASSWORD=hashlib.md5((botname+config.PASSWORD).encode('utf-8')).hexdigest()
  20. proceed_to=["open_servicerequest_booked@ej.sharix-app.org"]
  21. token = jsreq.requestGetToken(botname, PASSWORD, config.API_URL+"/api/v1/auth/token/login/")
  22. bot = JabberBot(JID, PASSWORD, PORT)
  23. def send_msg(msg):
  24. bot.send_notification(msg)