Skip to content

Commit bd06c2b

Browse files
committed
refactoring as extentension
1 parent ccfb7d0 commit bd06c2b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

coc/ext/FullWarApi.py renamed to coc/ext/FullWarApi/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import aiohttp
1313

14-
from ..http import json_or_text
15-
from ..utils import correct_tag
16-
from ..wars import ClanWar
14+
from ...http import json_or_text
15+
from ...utils import correct_tag
16+
from ...wars import ClanWar
1717

1818
LOG = logging.getLogger(__name__)
1919

@@ -142,9 +142,7 @@ async def _get_key(self):
142142
return self.key.token
143143

144144
async def _refresh_key(self):
145-
#REMOVE THIS EMAIL WHEN POSSIBLE
146145
data = {
147-
"email" : "[email protected]",
148146
"username": self.username,
149147
"password": self.password,
150148
}
@@ -170,7 +168,9 @@ async def war_result(self, clan_tag: str, preparation_start: int = 0) -> ClanWar
170168
Optional[:class:`ClanWar`]
171169
War result, or ``None`` if no war found.
172170
"""
173-
data = await self._request("GET", f"/war_result?clan_tag={correct_tag(clan_tag, '%23')}&prep_start={str(preparation_start)}")
171+
data = await self._request("GET",
172+
f"/war_result?clan_tag={correct_tag(clan_tag, '%23')}"
173+
f"&prep_start={str(preparation_start)}")
174174
try:
175175
return ClanWar(data=data["response"], client=self.clash_client)
176176
except (IndexError, KeyError, TypeError, ValueError):
@@ -194,7 +194,8 @@ async def war_result_log(self, clan_tag: str, preparation_start: int = 0) -> Lis
194194
Optional[:class:`ClanWar`]
195195
List of war results, or ``None`` if no wars found.
196196
"""
197-
data = await self._request("GET", f"/war_result_log?clan_tag={correct_tag(clan_tag, '%23')}")
197+
data = await self._request("GET",
198+
f"/war_result_log?clan_tag={correct_tag(clan_tag, '%23')}")
198199
try:
199200
responses = data["log"]
200201
return [ClanWar(data=response["response"], client=self.clash_client) for response in responses]
@@ -212,5 +213,7 @@ async def register_war(self, clan_tag: str, preparation_start: int = 0):
212213
preparation_start: int
213214
Preparation time of the war
214215
"""
215-
return await self._request("POST", f"/war_result?clan_tag={correct_tag(clan_tag, '%23')}&prep_start={str(preparation_start)}")
216+
return await self._request("POST",
217+
f"/war_result?clan_tag={correct_tag(clan_tag, '%23')}"
218+
f"&prep_start={str(preparation_start)}")
216219

0 commit comments

Comments
 (0)