Skip to content

Commit

Permalink
Fix realtime kwargs (#258)
Browse files Browse the repository at this point in the history
* Don't pass realtime twice

* Update version to 3.8.3

Bumped the library version to 3.8.3 in multiple file. Updated the changelog to document this fix.
  • Loading branch information
doluk authored Jan 9, 2025
1 parent f36b4b5 commit 54f2b24
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion coc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
SOFTWARE.
"""

__version__ = "3.8.2"
__version__ = "3.8.3"

from .abc import BasePlayer, BaseClan
from .clans import RankedClan, Clan
Expand Down
25 changes: 4 additions & 21 deletions coc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def _defaults(self):
"lookup_cache": self.lookup_cache,
"update_cache": self.update_cache,
"ignore_cached_errors": self.ignore_cached_errors,
"realtime": self.realtime,
}

async def __aenter__(self):
Expand Down Expand Up @@ -957,15 +958,7 @@ async def get_clan_war(self, clan_tag: str, cls: Type[ClanWar] = None, **kwargs)
clan_tag = correct_tag(clan_tag)

try:
realtime = kwargs.get("realtime")
except KeyError:
realtime = None

try:
data = await self.http.get_clan_current_war(clan_tag, realtime=realtime,
lookup_cache=kwargs.get("lookup_cache", self.lookup_cache),
update_cache=kwargs.get("update_cache", self.update_cache),
ignore_cached_errors=kwargs.get("ignore_cached_errors", self.ignore_cached_errors))
data = await self.http.get_clan_current_war(clan_tag, **{**self._defaults, **kwargs})
except Forbidden as exception:
raise PrivateWarLog(exception.response, exception.reason) from exception

Expand Down Expand Up @@ -1082,12 +1075,7 @@ async def get_league_group(
clan_tag = correct_tag(clan_tag)

try:
realtime = kwargs.get("realtime")
except KeyError:
realtime = None

try:
data = await self.http.get_clan_war_league_group(clan_tag, realtime=realtime, **{**self._defaults, **kwargs})
data = await self.http.get_clan_war_league_group(clan_tag, **{**self._defaults, **kwargs})
except Forbidden as exception:
raise PrivateWarLog(exception.response, exception.reason) from exception
except asyncio.TimeoutError:
Expand Down Expand Up @@ -1140,12 +1128,7 @@ async def get_league_war(self, war_tag: str, cls: Type[ClanWar] = None, **kwargs
war_tag = correct_tag(war_tag)

try:
realtime = kwargs.get("realtime")
except KeyError:
realtime = None

try:
data = await self.http.get_cwl_wars(war_tag, realtime=realtime, **{**self._defaults, **kwargs})
data = await self.http.get_cwl_wars(war_tag, **{**self._defaults, **kwargs})
except Forbidden as exception:
raise PrivateWarLog(exception.response, exception.reason) from exception

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
project = 'coc'
copyright = '2022, mathsman5133'
author = 'mathsman5133'
release = '3.8.2'
release = '3.8.3'


# -- General configuration ---------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions docs/miscellaneous/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Changelog
This page keeps a fairly detailed, human readable version
of what has changed, and whats new for each version of the lib.

v3.8.3
------

Bugs Fixed:
~~~~~~~~~~~
- Fixed a bug in serveral war related endpoints that passed realtime twice to the http client.

v3.8.2
------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "coc.py"
authors = [{ name = "mathsman5133" }]
maintainers = [{ name = "majordoobie" }, { name = "MagicTheDev" }, { name = "Kuchenmampfer" },
{ name = "lukasthaler"}, { name = "doluk"}]
version = "3.8.2"
version = "3.8.3"
description = "A python wrapper for the Clash of Clans API"
requires-python = ">=3.7.3"
readme = "README.rst"
Expand Down

0 comments on commit 54f2b24

Please sign in to comment.