Skip to content

Commit dfc2bff

Browse files
authored
fix(people): correct friends list API endpoint for target users (#103)
The `get_friends_by_xuid` method was incorrectly routing to `/users/me/people/xuids({xuid})/` which only checks the relationship between the authenticated user and the target, returning empty data (0 friends) if they aren't mutual friends. This fixes the URL path to `/users/xuid({xuid})/people/friends/` as in Xbox Android app, correctly utilizing Xbox Live Contract v7 to fetch a target user's friends list.
1 parent 277d643 commit dfc2bff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pythonxbox/api/provider/people/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ async def get_friends_by_xuid(
7171
**kwargs,
7272
) -> PeopleResponse:
7373
"""
74-
Get friendlist of own profile
74+
Get friendlist of a user by their XUID
75+
76+
Args:
77+
xuid: XUID of the user to get friends from
7578
7679
Returns:
7780
:class:`PeopleResponse`: People Response
@@ -85,7 +88,7 @@ async def get_friends_by_xuid(
8588
]
8689
decoration = self.SEPERATOR.join(decoration_fields)
8790

88-
url = f"{self.PEOPLE_URL}/users/me/people/xuids({xuid})/decoration/{decoration}"
91+
url = f"{self.PEOPLE_URL}/users/xuid({xuid})/people/friends/decoration/{decoration}"
8992
resp = await self.client.session.get(url, headers=self._headers, **kwargs)
9093
resp.raise_for_status()
9194
return PeopleResponse.model_validate_json(resp.text)

0 commit comments

Comments
 (0)