1- from .client import Client
2- from .http import POST , Request , request_method
3- from .util import ensure_text
1+ # -*- coding: utf-8 -*-
2+
3+ from __future__ import (
4+ print_function ,
5+ unicode_literals ,
6+ absolute_import ,
7+ division )
8+
9+ from pusher .client import Client
10+ from pusher .http import POST , Request , request_method
11+ from pusher .util import ensure_text
12+
413
514DEFAULT_HOST = "nativepush-cluster1.pusher.com"
615RESTRICTED_GCM_KEYS = ['to' , 'registration_ids' ]
918GCM_TTL = 241920
1019WEBHOOK_LEVELS = ['INFO' , 'DEBUG' , '' ]
1120
21+
1222class NotificationClient (Client ):
13- def __init__ (self , app_id , key , secret , ssl = True , host = None , port = None , timeout = 5 , cluster = None ,
14- json_encoder = None , json_decoder = None , backend = None , ** backend_options ):
23+ def __init__ (
24+ self , app_id , key , secret , ssl = True , host = None , port = None ,
25+ timeout = 5 , cluster = None , json_encoder = None , json_decoder = None ,
26+ backend = None , ** backend_options ):
1527 super (NotificationClient , self ).__init__ (
16- app_id , key , secret , ssl ,
17- host , port , timeout , cluster ,
18- json_encoder , json_decoder , backend ,
19- ** backend_options )
28+ app_id , key , secret , ssl , host , port , timeout , cluster ,
29+ json_encoder , json_decoder , backend , ** backend_options )
2030
2131 if host :
2232 self ._host = ensure_text (host , "host" )
33+
2334 else :
2435 self ._host = DEFAULT_HOST
2536
@@ -36,8 +47,10 @@ def notify(self, interests, notification):
3647 raise TypeError ("Notification must be a dictionary" )
3748
3849 params = {
39- 'interests' : interests ,
40- }
50+ 'interests' : interests }
51+
4152 params .update (notification )
42- path = "/%s/%s/apps/%s/notifications" % (API_PREFIX , API_VERSION , self .app_id )
53+ path = "/%s/%s/apps/%s/notifications" %
54+ (API_PREFIX , API_VERSION , self .app_id )
55+
4356 return Request (self , POST , path , params )
0 commit comments