|
@@ -35,25 +35,17 @@ class Test(View):
|
|
|
master_secret = '6ce8d1ce403ae102661ca3b8'
|
|
|
|
|
|
_jpush = jpush.JPush(app_key, master_secret)
|
|
|
- _jpush.set_logging("DEBUG")
|
|
|
- ###########
|
|
|
push = _jpush.create_push()
|
|
|
-
|
|
|
+ # if you set the logging level to "DEBUG",it will show the debug logging.
|
|
|
+ _jpush.set_logging("DEBUG")
|
|
|
# push.audience = jpush.all_
|
|
|
- push.audience = devToken
|
|
|
+ push.audience = jpush.registration_id(devToken)
|
|
|
+ push.notification = jpush.notification(alert="hello python jpush api")
|
|
|
push.platform = jpush.all_
|
|
|
-
|
|
|
- # ios = jpush.ios(alert="Hello, IOS JPush!", sound="a.caf", extras={'k1': 'v1'})
|
|
|
- android = jpush.android(alert="Hello, Android msg", priority=1, style=1, alert_type=1, big_text='jjjjjjjjjj',
|
|
|
- extras={'k1': 'v1'})
|
|
|
-
|
|
|
- push.notification = jpush.notification(alert="Hello, JPush!", android=android)
|
|
|
-
|
|
|
- # pprint (push.payload)
|
|
|
- push.send()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ try:
|
|
|
+ response = push.send()
|
|
|
+ except:
|
|
|
+ print("Exception")
|
|
|
return response.json(0)
|
|
|
|
|
|
def post(self, request, *args, **kwargs):
|