Skip to content

Commit 17b62d0

Browse files
authoredJun 16, 2022
Merge pull request #18 from takos22/1.2.x
[RELEASE] v1.2.4
·
v1.4.3v1.2.4
2 parents 34140e1 + ae07f8b commit 17b62d0

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed
 

‎CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ Changed
2929
- Deprecated `Notification.creation_time <https://codingame.readthedocs.io/en/latest/api.html#codingame.Notification.creation_time>`__ in favor of
3030
`Notification.date <https://codingame.readthedocs.io/en/latest/api.html#codingame.Notification.date>`__
3131

32+
Version 1.2.4 (2022-06-17)
33+
--------------------------
34+
35+
Fixed
36+
*****
37+
38+
- `CodinGamer.get_followers <https://codingame.readthedocs.io/en/latest/api.html#codingame.CodinGamer.get_followers>`__ and `CodinGamer.get_followed <https://codingame.readthedocs.io/en/latest/api.html#codingame.CodinGamer.get_followed>`__ now work
39+
while being logged in as any user, not just as the user you want to get the
40+
followers of.
41+
3242
Version 1.2.3 (2021-11-07)
3343
--------------------------
3444

‎codingame/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"VersionInfo", major=int, minor=int, micro=int, releaselevel=str, serial=int
1212
)
1313

14-
version_info = VersionInfo(major=1, minor=2, micro=3, releaselevel="", serial=0)
14+
version_info = VersionInfo(major=1, minor=2, micro=4, releaselevel="", serial=0)
1515

1616
__title__ = "codingame"
1717
__author__ = "takos22"
18-
__version__ = "1.2.3"
18+
__version__ = "1.2.4"
1919

2020
from .clash_of_code import ClashOfCode, Player
2121
from .client import Client

‎codingame/codingamer.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def get_followers(
156156
157157
Get all the followers of a CodinGamer.
158158
159-
You need to be logged in as the CodinGamer to get its followers
160-
or else a :exc:`LoginRequired` will be raised. If you can't log in,
161-
you can use :meth:`CodinGamer.get_followers_ids` instead.
159+
You need to be logged in to get the followers or else a
160+
:exc:`LoginRequired` will be raised. If you can't log in, you can use
161+
:meth:`CodinGamer.get_followers_ids` instead.
162162
163163
.. note::
164164
This property is a generator.
@@ -174,25 +174,24 @@ def get_followers(
174174
The follower.
175175
"""
176176

177-
if (
178-
not self._state.logged_in
179-
or self.public_handle != self._state.codingamer.public_handle
180-
):
177+
if not self._state.logged_in:
181178
raise LoginRequired()
182179

183180
if self._state.is_async:
184181

185182
async def _get_followers():
186183
followers = await self._state.http.get_codingamer_followers(
187-
self.id
184+
self.id, self._state.codingamer.id
188185
)
189186
for follower in followers:
190187
yield CodinGamer(self._state, follower)
191188

192189
else:
193190

194191
def _get_followers():
195-
followers = self._state.http.get_codingamer_followers(self.id)
192+
followers = self._state.http.get_codingamer_followers(
193+
self.id, self._state.codingamer.id
194+
)
196195
for follower in followers:
197196
yield CodinGamer(self._state, follower)
198197

@@ -222,9 +221,9 @@ def get_followed(
222221
223222
Get all the followed CodinGamers.
224223
225-
You need to be logged in as the CodinGamer to get its followed
226-
CodinGamers or else a :exc:`LoginRequired` will be raised. If you can't
227-
log in, you can use :meth:`CodinGamer.get_followed_ids` instead.
224+
You need to be logged in to get the followed CodinGamers or else a
225+
:exc:`LoginRequired` will be raised. If you can't log in, you can use
226+
:meth:`CodinGamer.get_followed_ids` instead.
228227
229228
.. note::
230229
This property is a generator.
@@ -240,25 +239,24 @@ def get_followed(
240239
The followed CodinGamer.
241240
"""
242241

243-
if (
244-
not self._state.logged_in
245-
or self.public_handle != self._state.codingamer.public_handle
246-
):
242+
if not self._state.logged_in:
247243
raise LoginRequired()
248244

249245
if self._state.is_async:
250246

251247
async def _get_followed():
252248
followeds = await self._state.http.get_codingamer_following(
253-
self.id
249+
self.id, self._state.codingamer.id
254250
)
255251
for followed in followeds:
256252
yield CodinGamer(self._state, followed)
257253

258254
else:
259255

260256
def _get_followed():
261-
followeds = self._state.http.get_codingamer_following(self.id)
257+
followeds = self._state.http.get_codingamer_following(
258+
self.id, self._state.codingamer.id
259+
)
262260
for followed in followeds:
263261
yield CodinGamer(self._state, followed)
264262

‎codingame/http/base.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,22 @@ def get_codingamer_from_id(self, id: int) -> CodinGamerFromID:
7575
"CodinGamer", "findCodinGamerPublicInformations", [id]
7676
)
7777

78-
def get_codingamer_followers(self, id: int) -> typing.List[Follower]:
79-
return self.request("CodinGamer", "findFollowers", [id, id, None])
78+
def get_codingamer_followers(
79+
self, id: int, current_id: int = None
80+
) -> typing.List[Follower]:
81+
return self.request(
82+
"CodinGamer", "findFollowers", [id, current_id or id, None]
83+
)
8084

8185
def get_codingamer_follower_ids(self, id: int) -> typing.List[int]:
8286
return self.request("CodinGamer", "findFollowerIds", [id])
8387

84-
def get_codingamer_following(self, id: int) -> typing.List[Following]:
85-
return self.request("CodinGamer", "findFollowing", [id, id])
88+
def get_codingamer_following(
89+
self, id: int, current_id: int = None
90+
) -> typing.List[Following]:
91+
return self.request(
92+
"CodinGamer", "findFollowing", [id, current_id or id]
93+
)
8694

8795
def get_codingamer_following_ids(self, id: int) -> typing.List[int]:
8896
return self.request("CodinGamer", "findFollowingIds", [id])

‎docs/changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ Changed
3131
- Deprecated :attr:`Notification.creation_time` in favor of
3232
:attr:`Notification.date`
3333

34+
Version 1.2.4 (2022-06-17)
35+
--------------------------
36+
37+
Fixed
38+
*****
39+
40+
- :meth:`CodinGamer.get_followers` and :meth:`CodinGamer.get_followed` now work
41+
while being logged in as any user, not just as the user you want to get the
42+
followers of.
43+
3444
Version 1.2.3 (2021-11-07)
3545
--------------------------
3646

0 commit comments

Comments
 (0)