MCPcopy Index your code
hub / github.com/praw-dev/praw / friends

Method friends

praw/models/user.py:88–103  ·  view source on GitHub ↗

r"""Return a :class:`.RedditorList` of friends or a :class:`.Redditor` in the friends list. :param user: Checks to see if you are friends with the redditor. Either an instance of :class:`.Redditor` or a string can be given. :returns: A list of :class:`.Redditor`\ s, or

(self, *, user: str | models.Redditor | None = None)

Source from the content-addressed store, hash-verified

86 return ListingGenerator(self._reddit, API_PATH["my_contributor"], **generator_kwargs)
87
88 def friends(self, *, user: str | models.Redditor | None = None) -> list[models.Redditor] | models.Redditor:
89 r"""Return a :class:`.RedditorList` of friends or a :class:`.Redditor` in the friends list.
90
91 :param user: Checks to see if you are friends with the redditor. Either an
92 instance of :class:`.Redditor` or a string can be given.
93
94 :returns: A list of :class:`.Redditor`\ s, or a single :class:`.Redditor` if
95 ``user`` is specified. The :class:`.Redditor` instance(s) returned also has
96 friend attributes.
97
98 :raises: An instance of :class:`.RedditAPIException` if you are not friends with
99 the specified :class:`.Redditor`.
100
101 """
102 endpoint = API_PATH["friends"] if user is None else API_PATH["friend_v1"].format(user=str(user))
103 return self._reddit.get(endpoint)
104
105 def karma(self) -> dict[models.Subreddit, dict[str, int]]:
106 r"""Return a dictionary mapping :class:`.Subreddit`\ s to their karma.

Callers 4

test_friend_existMethod · 0.80
test_friend_not_existMethod · 0.80
test_friendsMethod · 0.80
test_unfriendMethod · 0.80

Calls 1

getMethod · 0.80

Tested by 4

test_friend_existMethod · 0.64
test_friend_not_existMethod · 0.64
test_friendsMethod · 0.64
test_unfriendMethod · 0.64