MCPcopy
hub / github.com/praw-dev/praw / me

Method me

praw/models/user.py:126–145  ·  view source on GitHub ↗

Return a :class:`.Redditor` instance for the authenticated user. :param use_cache: When ``True``, and if this function has been previously called, returned the cached version (default: ``True``). .. note:: If you change the :class:`.Reddit` instance's autho

(self, *, use_cache: bool = True)

Source from the content-addressed store, hash-verified

124 return karma_map
125
126 def me(self, *, use_cache: bool = True) -> models.Redditor | None:
127 """Return a :class:`.Redditor` instance for the authenticated user.
128
129 :param use_cache: When ``True``, and if this function has been previously
130 called, returned the cached version (default: ``True``).
131
132 .. note::
133
134 If you change the :class:`.Reddit` instance's authorization, you might want
135 to refresh the cached value. Prefer using separate :class:`.Reddit`
136 instances, however, for distinct authorizations.
137
138 """
139 if self._reddit.read_only:
140 msg = "`user.me()` does not work in read_only mode"
141 raise ReadOnlyException(msg)
142 if "_me" not in self.__dict__ or not use_cache:
143 user_data = self._reddit.get(API_PATH["me"])
144 self._me = Redditor(self._reddit, _data=user_data)
145 return self._me
146
147 def moderator_subreddits(self, **generator_kwargs: Any) -> Iterator[models.Subreddit]:
148 """Return a :class:`.ListingGenerator` subreddits that the user moderates.

Callers 15

unblockMethod · 0.80
copyMethod · 0.80
__iter__Method · 0.80
addMethod · 0.80
removeMethod · 0.80
leaveMethod · 0.80
test_friend_existMethod · 0.80
test_meMethod · 0.80
test_me__bypass_cacheMethod · 0.80
test_pinMethod · 0.80
test_pin__commentMethod · 0.80

Calls 3

ReadOnlyExceptionClass · 0.90
RedditorClass · 0.90
getMethod · 0.80

Tested by 15

test_friend_existMethod · 0.64
test_meMethod · 0.64
test_me__bypass_cacheMethod · 0.64
test_pinMethod · 0.64
test_pin__commentMethod · 0.64
test_pin__empty_slotMethod · 0.64
test_pin__invalid_numMethod · 0.64
test_pin__numMethod · 0.64
test_pin__removeMethod · 0.64
test_pin__remove_numMethod · 0.64