From 54f2b2487dac71ad63cca284857e3c13623bbf57 Mon Sep 17 00:00:00 2001 From: Lukas Dobler <69309597+doluk@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:19:27 +0100 Subject: [PATCH] Fix realtime kwargs (#258) * 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. --- coc/__init__.py | 2 +- coc/client.py | 25 ++++--------------------- docs/conf.py | 2 +- docs/miscellaneous/changelog.rst | 7 +++++++ pyproject.toml | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/coc/__init__.py b/coc/__init__.py index d181948d..b91e6f5a 100644 --- a/coc/__init__.py +++ b/coc/__init__.py @@ -22,7 +22,7 @@ SOFTWARE. """ -__version__ = "3.8.2" +__version__ = "3.8.3" from .abc import BasePlayer, BaseClan from .clans import RankedClan, Clan diff --git a/coc/client.py b/coc/client.py index ed2e39a4..0dc33d46 100644 --- a/coc/client.py +++ b/coc/client.py @@ -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): @@ -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 @@ -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: @@ -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 diff --git a/docs/conf.py b/docs/conf.py index 15100519..851b785d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,7 @@ project = 'coc' copyright = '2022, mathsman5133' author = 'mathsman5133' -release = '3.8.2' +release = '3.8.3' # -- General configuration --------------------------------------------------- diff --git a/docs/miscellaneous/changelog.rst b/docs/miscellaneous/changelog.rst index 583b0892..c1291770 100644 --- a/docs/miscellaneous/changelog.rst +++ b/docs/miscellaneous/changelog.rst @@ -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 ------ diff --git a/pyproject.toml b/pyproject.toml index 56a36fef..41b4ade6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"