Skip to content

Commit

Permalink
fix leaderboard for the new api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SharpBit committed Dec 14, 2018
1 parent 8771405 commit 2c56bb4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.1.10] - 12/13/18
- Fix any data that involves a list (Leaderboard)

## [2.1.9] - 12/11/18
## Added
- `get_datetime` function for easier date and time conversions
Expand Down
2 changes: 1 addition & 1 deletion brawlstats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
############


__version__ = 'v2.1.9'
__version__ = 'v2.1.10'
__title__ = 'brawlstats'
__license__ = 'MIT'
__author__ = 'SharpBit'
Expand Down
11 changes: 7 additions & 4 deletions brawlstats/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def __getattr__(self, attr):

def __getitem__(self, item):
try:
return getattr(self._boxed_data, item)
except AttributeError:
raise KeyError('No such key: {}'.format(item))
return self._boxed_data[item]
except IndexError:
raise IndexError('No such index: {}'.format(item))


class Client:
Expand Down Expand Up @@ -305,7 +305,7 @@ def get_full(self):
"""
Gets the full club statistics.
Returns club
Returns Club
"""
return self.client.get_club(self.tag)

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

def __len__(self):
return sum(1 for i in self)

def __repr__(self):
return "<Leaderboard object count={}>".format(len(self))

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = '2.1'
# The full version, including alpha/beta/rc tags
release = '2.1.9'
release = '2.1.10'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='brawlstats',
version='2.1.9',
version='2.1.10',
description='An async Python API wrapper for the unofficial Brawl Stars API',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down

0 comments on commit 2c56bb4

Please sign in to comment.