Skip to content

Commit

Permalink
fix(wattpad): Include self in follower's and following's follower and…
Browse files Browse the repository at this point in the history
… following lists in fetch functions
  • Loading branch information
TheOnlyWayUp committed Feb 2, 2024
1 parent 0af0eaf commit dc212ed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wattpad/wattpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ async def fetch_followers(
user_cls = User(
username=username
) # ! This code is an artefact of the singleton design model. If a user already exists, their data will not be updated otherwise.
user_cls.following.append(
self
) # ! The current user is followed by this fetched user
user_cls._update_data(**user)
followers.append(user_cls)

Expand Down Expand Up @@ -245,10 +248,15 @@ async def fetch_following(
following: list[User] = []
for user in data["users"]:
username = user.pop("username")

user_cls = User(
username=username
) # ! This code is an artefact of the singleton design model. If a user already exists, their data will not be updated otherwise.
user_cls.followers.append(
self
) # ! The current user follows this fetched user
user_cls._update_data(**user)

following.append(user_cls)

self.followers = following
Expand Down

0 comments on commit dc212ed

Please sign in to comment.