@@ -80,6 +80,28 @@ def get_cid(self, count, type = None):
80
80
response = self ._jpush ._request ('GET' , body , url , 'application/json' , version = 3 , params = params )
81
81
return PushResponse (response )
82
82
83
+ def batch_push_by_regid (self , single_payload_list ):
84
+ cid_response = self .get_cid (len (single_payload_list ), 'push' )
85
+ cidlist = cid_response .payload ['cidlist' ]
86
+ batch_payload = {"pushlist" :{}}
87
+ for index in range (len (single_payload_list )):
88
+ batch_payload ["pushlist" ][cidlist [index ]] = single_payload_list [index ]
89
+ body = json .dumps (batch_payload )
90
+ url = common .get_url ('push' , self .zone ) + 'push/batch/regid/single'
91
+ response = self ._jpush ._request ('POST' , body , url , 'application/json' , version = 3 )
92
+ return PushResponse (response )
93
+
94
+ def batch_push_by_alias (self , single_payload_list ):
95
+ cid_response = self .get_cid (len (single_payload_list ), 'push' )
96
+ cidlist = cid_response .payload ['cidlist' ]
97
+ batch_payload = {"pushlist" :{}}
98
+ for index in range (len (single_payload_list )):
99
+ batch_payload ["pushlist" ][cidlist [index ]] = single_payload_list [index ]
100
+ body = json .dumps (batch_payload )
101
+ url = common .get_url ('push' , self .zone ) + 'push/batch/alias/single'
102
+ response = self ._jpush ._request ('POST' , body , url , 'application/json' , version = 3 )
103
+ return PushResponse (response )
104
+
83
105
84
106
class PushResponse (object ):
85
107
"""Response to a successful push notification send.
0 commit comments