reddit.user¶
-
class
praw.models.
User
(reddit: Reddit)¶ The user class provides methods for the currently authenticated user.
-
__init__
(reddit: Reddit)¶ Initialize a User instance.
This class is intended to be interfaced with through
reddit.user
.
-
blocked
() → List[praw.models.reddit.redditor.Redditor]¶ Return a RedditorList of blocked Redditors.
-
contributor_subreddits
(**generator_kwargs) → Generator[[praw.models.reddit.subreddit.Subreddit, None], None]¶ Return a
ListingGenerator
of subreddits user is a contributor of.Additional keyword arguments are passed in the initialization of
ListingGenerator
.
-
friends
() → List[praw.models.reddit.redditor.Redditor]¶ Return a RedditorList of friends.
-
karma
() → Dict[praw.models.reddit.subreddit.Subreddit, int]¶ Return a dictionary mapping subreddits to their karma.
-
me
(use_cache: bool = True) → Optional[praw.models.reddit.redditor.Redditor]¶ Return a
Redditor
instance for the authenticated user.In
read_only
mode, this method returnsNone
.Parameters: use_cache – When true, and if this function has been previously called, returned the cached version (default: True). Note
If you change the Reddit instance’s authorization, you might want to refresh the cached value. Prefer using separate Reddit instances, however, for distinct authorizations.
-
moderator_subreddits
(**generator_kwargs) → Generator[[praw.models.reddit.subreddit.Subreddit, None], None]¶ Return a
ListingGenerator
of moderated subreddits.- ..warning:: (Deprecated) This method will be removed in the next major
- version of PRAW. Please use
Redditor.moderated()
instead.
Additional keyword arguments are passed in the initialization of
ListingGenerator
.Note
This method will return a maximum of 100 moderated subreddits, ordered by subscriber count. To retrieve more than 100 moderated subreddits, please see
Redditor.moderated()
.Usage:
for subreddit in reddit.user.moderator_subreddits(): print(subreddit.display_name)
-
multireddits
() → List[Multireddit]¶ Return a list of multireddits belonging to the user.
-
classmethod
parse
(data: Dict[str, Any], reddit: Reddit) → Any¶ Return an instance of
cls
fromdata
.Parameters: - data – The structured data.
- reddit – An instance of
Reddit
.
-
preferences
¶ Get an instance of
Preferences
.The preferences can be accessed as a
dict
like so:preferences = reddit.user.preferences() print(preferences['show_link_flair'])
Preferences can be updated via:
reddit.user.preferences.update(show_link_flair=True)
The
Preferences.update()
method returns the new state of the preferences as adict
, which can be used to check whether a change went through. Changes with invalid types or parameter names fail silently.original_preferences = reddit.user.preferences() new_preferences = reddit.user.preferences.update(invalid_param=123) print(original_preferences == new_preferences) # True, no change
-
subreddits
(**generator_kwargs) → Generator[[praw.models.reddit.subreddit.Subreddit, None], None]¶ Return a
ListingGenerator
of subreddits the user is subscribed to.Additional keyword arguments are passed in the initialization of
ListingGenerator
.
-