@@ -171,7 +171,7 @@ def __init__(self, rate_limit, name=None, percentage=80):
171171 self ._minimal_limit = 1000000000
172172 from_dict = isinstance (rate_limit , dict )
173173 if from_dict :
174- self ._rate_limit_dict = rate_limit .get ('rateLimit ' , rate_limit )
174+ self ._rate_limit_dict = rate_limit .get ('rateLimits ' , rate_limit )
175175 name = rate_limit .get ('name' , name )
176176 percentage = rate_limit .get ('percentage' , percentage )
177177 self ._no_limit = rate_limit .get ('no_limit' , False )
@@ -265,7 +265,7 @@ def set_limit(self, rate_limit, percentage=80):
265265 @property
266266 def __dict__ (self ):
267267 return {
268- "rateLimit " : self ._rate_limit_dict ,
268+ "rateLimits " : self ._rate_limit_dict ,
269269 "name" : self .name ,
270270 "percentage" : self .percentage ,
271271 "no_limit" : self ._no_limit
@@ -694,12 +694,12 @@ def on_service_configuration(self, _, response, *args, **kwargs):
694694 self .rate_limits_received = True
695695 return
696696 service_config = response
697- if not isinstance (service_config , dict ) or 'rateLimit ' not in service_config :
697+ if not isinstance (service_config , dict ) or 'rateLimits ' not in service_config :
698698 log .warning ("Cannot retrieve service configuration, session will use default configuration." )
699699 log .debug ("Received the following response: %r" , service_config )
700700 return
701- if service_config .get ("rateLimit " ):
702- rate_limits_config = service_config .get ("rateLimit " )
701+ if service_config .get ("rateLimits " ):
702+ rate_limits_config = service_config .get ("rateLimits " )
703703
704704 if rate_limits_config .get ('messages' ):
705705 self ._messages_rate_limit .set_limit (rate_limits_config .get ('messages' ))
0 commit comments