Skip to content

Commit 2c56bb4

Browse files
committed
fix leaderboard for the new api changes
1 parent 8771405 commit 2c56bb4

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [2.1.10] - 12/13/18
5+
- Fix any data that involves a list (Leaderboard)
6+
47
## [2.1.9] - 12/11/18
58
## Added
69
- `get_datetime` function for easier date and time conversions

brawlstats/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
############
88

99

10-
__version__ = 'v2.1.9'
10+
__version__ = 'v2.1.10'
1111
__title__ = 'brawlstats'
1212
__license__ = 'MIT'
1313
__author__ = 'SharpBit'

brawlstats/core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def __getattr__(self, attr):
4141

4242
def __getitem__(self, item):
4343
try:
44-
return getattr(self._boxed_data, item)
45-
except AttributeError:
46-
raise KeyError('No such key: {}'.format(item))
44+
return self._boxed_data[item]
45+
except IndexError:
46+
raise IndexError('No such index: {}'.format(item))
4747

4848

4949
class Client:
@@ -305,7 +305,7 @@ def get_full(self):
305305
"""
306306
Gets the full club statistics.
307307
308-
Returns club
308+
Returns Club
309309
"""
310310
return self.client.get_club(self.tag)
311311

@@ -327,6 +327,9 @@ class Leaderboard(BaseBox):
327327
Returns a player or club leaderboard that contains a list of players or clubs.
328328
"""
329329

330+
def __len__(self):
331+
return sum(1 for i in self)
332+
330333
def __repr__(self):
331334
return "<Leaderboard object count={}>".format(len(self))
332335

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = '2.1'
2828
# The full version, including alpha/beta/rc tags
29-
release = '2.1.9'
29+
release = '2.1.10'
3030

3131

3232
# -- General configuration ---------------------------------------------------

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='brawlstats',
8-
version='2.1.9',
8+
version='2.1.10',
99
description='An async Python API wrapper for the unofficial Brawl Stars API',
1010
long_description=long_description,
1111
long_description_content_type='text/x-rst',

0 commit comments

Comments
 (0)