@@ -189,7 +189,7 @@ def get_leaderboard(self, player_or_club: str, count: int=200):
189189 """
190190 if type (count ) != int :
191191 raise ValueError ("Make sure 'count' is an int" )
192- if player_or_club .lower () not in ('players' , 'clubs' ) or count > 200 or count < 1 :
192+ if player_or_club .lower () not in ('players' , 'clubs' ) or not 0 < count <= 200 :
193193 raise ValueError ("Please enter 'players' or 'clubs' or make sure 'count' is between 1 and 200." )
194194 url = self .api .leaderboard + '/' + player_or_club + '/' + str (count )
195195 if self .is_async :
@@ -212,6 +212,34 @@ def get_events(self):
212212
213213 return Events (self , resp , data )
214214
215+ async def _get_constants_async (self , key ):
216+ data , resp = await self ._aget (self .api .constants )
217+ if key and not data .get (key ):
218+ raise KeyError ('No such key for Brawl Stars constants "{}"' .format (key ))
219+ if key and data .get (key ):
220+ return Constants (self , resp , data .get (key ))
221+ return Constants (self , resp , data )
222+
223+ def get_constants (self , key = None ):
224+ """Gets Brawl Stars constants extracted from the app.
225+
226+ Parameters
227+ ----------
228+ key: Optional[str] = None
229+ Any key to get specific data.
230+
231+ Returns Constants
232+ """
233+ if self .is_async :
234+ return self ._get_constants_async (key )
235+ data , resp = await self ._get (self .api .constants )
236+ if key and not data .get (key ):
237+ raise KeyError ('No such key for Brawl Stars constants "{}"' .format (key ))
238+ if key and data .get (key ):
239+ return Constants (self , resp , data .get (key ))
240+ return Constants (self , resp , data )
241+
242+
215243class Profile (BaseBox ):
216244 """
217245 Returns a full player object with all of its attributes.
@@ -298,5 +326,11 @@ class Events(BaseBox):
298326 def __repr__ (self ):
299327 return '<Events object>'
300328
301- def __str__ (self ):
302- return 'Events object'
329+
330+ class Constants (BaseBox ):
331+ """
332+ Returns some Brawl Stars constants.
333+ """
334+
335+ def __repr__ (self ):
336+ return '<Constants object>'
0 commit comments