push_debug.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
  5. @AUTHOR: ASJRD018
  6. @NAME: AnsjerFormal
  7. @software: PyCharm
  8. @DATE: 2019/12/14 16:25
  9. @Version: python3.6
  10. @MODIFY DECORD:ansjer dev
  11. @file: push_debug.py
  12. @Contact: chanjunkai@163.com
  13. """
  14. import time
  15. app_key = "d9924f56d3cc7c6017965130"
  16. master_secret = "869d832d126a232f158b5987"
  17. devToken = "13065ffa4e65a3d5c40"
  18. import jpush as jpush
  19. # 此处换成各自的app_key和master_secret
  20. _jpush = jpush.JPush(app_key, master_secret)
  21. push = _jpush.create_push()
  22. # if you set the logging level to "DEBUG",it will show the debug logging.
  23. _jpush.set_logging("DEBUG")
  24. # push.audience = jpush.all_
  25. n_time = int(time.time())
  26. event_type = 51
  27. push.audience = jpush.registration_id(devToken)
  28. push_data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
  29. "received_at": n_time, "sound": "sound.aif", "uid": 'xoxoxoxoxoxoxoxoxoxo', "zpush": "1"}
  30. android = jpush.android(alert="Hello, Android msg", priority=1, style=1, alert_type=1, big_text='ssssssssssssssssss',
  31. extras=push_data, title='fffff')
  32. push.notification = jpush.notification(android=android)
  33. push.platform = jpush.all_
  34. push.send()