Redditor

class praw.models.Redditor(reddit, name=None, fullname=None, _data=None)

A class representing the users of Reddit.

Typical Attributes

Note

This table describes attributes that typically belong to objects of this class. PRAW dynamically provides the attributes that Reddit returns via the API. Since those attributes are subject to change on Reddit’s end, PRAW makes no effort to document any new/removed/changed attributes, other than to instruct you on how to discover what is available. As a result, this table of attributes may not be complete. See Determine Available Attributes of an Object for detailed information.

If you would like to add an attribute to this table, feel free to open a pull request.

Note

Shadowbanned accounts are treated the same as non-existent accounts, meaning that they will not have any attributes.

Note

Suspended/banned accounts will only return the name and is_suspended attributes.

Attribute

Description

comment_karma

The comment karma for the Redditor.

comments

Provide an instance of SubListing for comment access.

submissions

Provide an instance of SubListing for submission access.

created_utc

Time the account was created, represented in Unix Time.

has_verified_email

Whether or not the Redditor has verified their email.

icon_img

The url of the Redditors’ avatar.

id

The ID of the Redditor.

is_employee

Whether or not the Redditor is a Reddit employee.

is_friend

Whether or not the Redditor is friends with the authenticated user.

is_mod

Whether or not the Redditor mods any subreddits.

is_gold

Whether or not the Redditor has active Reddit Premium status.

is_suspended

Whether or not the Redditor is currently suspended.

link_karma

The link karma for the Redditor.

name

The Redditor’s username.

subreddit

If the Redditor has created a user-subreddit, provides a UserSubreddit with additional attributes.

Parameters:
__init__(reddit, name=None, fullname=None, _data=None)

Initialize a Redditor instance.

Parameters:
  • reddit (Reddit) – An instance of Reddit.

  • name (str | None) – The name of the redditor.

  • fullname (str | None) – The fullname of the redditor, starting with t2_.

  • _data (dict[str, Any] | None)

Return type:

None

Exactly one of name, fullname or _data must be provided.

block()

Block the Redditor.

For example, to block Redditor u/spez:

reddit.redditor("spez").block()

Note

Blocking a trusted user will remove that user from your trusted list.

See also

trust()

Return type:

None

comments()

Provide an instance of SubListing for comment access.

For example, to output the first line of all new comments by u/spez try:

for comment in reddit.redditor("spez").comments.new(limit=None):
    print(comment.body.split("\\n", 1)[0][:79])
Return type:

SubListing

controversial(*, time_filter='all', **generator_kwargs)

Return a ListingGenerator for controversial items.

Parameters:
  • time_filter (str) – Can be one of: "all", "day", "hour", "month", "week", or "year" (default: "all").

  • generator_kwargs (str | int | dict[str, str])

Raises:

ValueError if time_filter is invalid.

Return type:

Iterator[Any]

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").controversial(time_filter="week")
reddit.multireddit(redditor="samuraisam", name="programming").controversial(
    time_filter="day"
)
reddit.redditor("spez").controversial(time_filter="month")
reddit.redditor("spez").comments.controversial(time_filter="year")
reddit.redditor("spez").submissions.controversial(time_filter="all")
reddit.subreddit("all").controversial(time_filter="hour")
distrust()

Remove the Redditor from your whitelist of trusted users.

For example, to remove Redditor u/spez from your whitelist:

reddit.redditor("spez").distrust()

See also

trust()

Return type:

None

downvoted(**generator_kwargs)

Return a ListingGenerator for items the user has downvoted.

Return type:

Iterator[Comment | Submission]

Returns:

A ListingGenerator object which yields Comment or Submission objects the user has downvoted.

Raises:

prawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Parameters:

generator_kwargs (str | int | dict[str, str])

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all downvoted items of the authenticated user:

for item in reddit.user.me().downvoted():
    print(item.id)
friend(*, note=None)

Friend the Redditor.

Parameters:

note (str | None) – A note to save along with the relationship. Requires Reddit Premium (default: None).

Return type:

None

Calling this method subsequent times will update the note.

For example, to friend u/spez:

reddit.redditor("spez").friend()

To add a note to the friendship (requires Reddit Premium):

reddit.redditor("spez").friend(note="My favorite admin")
friend_info()

Return a Redditor instance with specific friend-related attributes.

Return type:

Redditor

Returns:

A Redditor instance with fields date, id, and possibly note if the authenticated user has Reddit Premium.

For example, to get the friendship information of Redditor u/spez:

info = reddit.redditor("spez").friend_info
friend_data = info.date
classmethod from_data(reddit, data)

Return an instance of Redditor, or None from data.

Return type:

Redditor | None

Parameters:
property fullname: str

Return the object’s fullname.

A fullname is an object’s kind mapping like t3 followed by an underscore and the object’s base36 ID, e.g., t1_c5s96e0.

hidden(**generator_kwargs)

Return a ListingGenerator for items the user has hidden.

Return type:

Iterator[Comment | Submission]

Returns:

A ListingGenerator object which yields Comment or Submission objects the user has hid.

Raises:

prawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Parameters:

generator_kwargs (str | int | dict[str, str])

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all hidden items of the authenticated user:

for item in reddit.user.me().hidden():
    print(item.id)
hot(**generator_kwargs)

Return a ListingGenerator for hot items.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").hot()
reddit.multireddit(redditor="samuraisam", name="programming").hot()
reddit.redditor("spez").hot()
reddit.redditor("spez").comments.hot()
reddit.redditor("spez").submissions.hot()
reddit.subreddit("all").hot()
Return type:

Iterator[Any]

Parameters:

generator_kwargs (str | int | dict[str, str])

message(*, from_subreddit=None, message, subject)

Send a message to a Redditor or a Subreddit’s moderators (modmail).

Parameters:
  • from_subreddit (Subreddit | str | None) –

    A Subreddit instance or string to send the message from. When provided, messages are sent from the subreddit rather than from the authenticated user.

    Note

    The authenticated user must be a moderator of the subreddit and have the mail moderator permission.

  • message (str) – The message content.

  • subject (str) – The subject of the message.

Return type:

None

For example, to send a private message to u/spez, try:

reddit.redditor("spez").message(subject="TEST", message="test message from PRAW")

To send a message to u/spez from the moderators of r/test try:

reddit.redditor("spez").message(
    subject="TEST", message="test message from r/test", from_subreddit="test"
)

To send a message to the moderators of r/test, try:

reddit.subreddit("test").message(subject="TEST", message="test PM from PRAW")
moderated()

Return a list of the redditor’s moderated subreddits.

Return type:

list[Subreddit]

Returns:

A list of Subreddit objects. Return [] if the redditor has no moderated subreddits.

Raises:

prawcore.ServerError in certain circumstances. See the note below.

Note

The redditor’s own user profile subreddit will not be returned, but other user profile subreddits they moderate will be returned.

Usage:

for subreddit in reddit.redditor("spez").moderated():
    print(subreddit.display_name)
    print(subreddit.title)

Note

A prawcore.ServerError exception may be raised if the redditor moderates a large number of subreddits. If that happens, try switching to read-only mode. For example,

reddit.read_only = True
for subreddit in reddit.redditor("reddit").moderated():
    print(str(subreddit))

It is possible that requests made in read-only mode will also raise a prawcore.ServerError exception.

When used in read-only mode, this method does not retrieve information about subreddits that require certain special permissions to access, e.g., private subreddits and premium-only subreddits.

multireddits()

Return a list of the redditor’s public multireddits.

For example, to to get Redditor u/spez’s multireddits:

multireddits = reddit.redditor("spez").multireddits()
Return type:

list[Multireddit]

new(**generator_kwargs)

Return a ListingGenerator for new items.

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").new()
reddit.multireddit(redditor="samuraisam", name="programming").new()
reddit.redditor("spez").new()
reddit.redditor("spez").comments.new()
reddit.redditor("spez").submissions.new()
reddit.subreddit("all").new()
Return type:

Iterator[Any]

Parameters:

generator_kwargs (str | int | dict[str, str])

notes()

Provide an instance of RedditorModNotes.

This provides an interface for managing moderator notes for a redditor.

Note

The authenticated user must be a moderator of the provided subreddit(s).

For example, all the notes for u/spez in r/test can be iterated through like so:

redditor = reddit.redditor("spez")

for note in redditor.notes.subreddits("test"):
    print(f"{note.label}: {note.note}")
Return type:

RedditorModNotes

classmethod parse(data, reddit)

Return an instance of cls from data.

Parameters:
Return type:

PRAWBase

saved(**generator_kwargs)

Return a ListingGenerator for items the user has saved.

Return type:

Iterator[Comment | Submission]

Returns:

A ListingGenerator object which yields Comment or Submission objects the user has saved.

Raises:

prawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Parameters:

generator_kwargs (str | int | dict[str, str])

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all saved items of the authenticated user:

for item in reddit.user.me().saved(limit=None):
    print(item.id)
stream()

Provide an instance of RedditorStream.

Streams can be used to indefinitely retrieve new comments made by a redditor, like:

for comment in reddit.redditor("spez").stream.comments():
    print(comment)

Additionally, new submissions can be retrieved via the stream. In the following example all submissions are fetched via the redditor u/spez:

for submission in reddit.redditor("spez").stream.submissions():
    print(submission)
Return type:

RedditorStream

submissions()

Provide an instance of SubListing for submission access.

For example, to output the title’s of top 100 of all time submissions for u/spez try:

for submission in reddit.redditor("spez").submissions.top(time_filter="all"):
    print(submission.title)
Return type:

SubListing

top(*, time_filter='all', **generator_kwargs)

Return a ListingGenerator for top items.

Parameters:
  • time_filter (str) – Can be one of: "all", "day", "hour", "month", "week", or "year" (default: "all").

  • generator_kwargs (str | int | dict[str, str])

Raises:

ValueError if time_filter is invalid.

Return type:

Iterator[Any]

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").top(time_filter="week")
reddit.multireddit(redditor="samuraisam", name="programming").top(time_filter="day")
reddit.redditor("spez").top(time_filter="month")
reddit.redditor("spez").comments.top(time_filter="year")
reddit.redditor("spez").submissions.top(time_filter="all")
reddit.subreddit("all").top(time_filter="hour")
trophies()

Return a list of the redditor’s trophies.

Return type:

list[Trophy]

Returns:

A list of Trophy objects. Return [] if the redditor has no trophies.

Raises:

RedditAPIException if the redditor doesn’t exist.

Usage:

for trophy in reddit.redditor("spez").trophies():
    print(trophy.name)
    print(trophy.description)
trust()

Add the Redditor to your whitelist of trusted users.

Trusted users will always be able to send you PMs.

Example usage:

reddit.redditor("spez").trust()

Use the accept_pms parameter of Preferences.update() to toggle your accept_pms setting between "everyone" and "whitelisted". For example:

# Accept private messages from everyone:
reddit.user.preferences.update(accept_pms="everyone")
# Only accept private messages from trusted users:
reddit.user.preferences.update(accept_pms="whitelisted")

You may trust a user even if your accept_pms setting is switched to "everyone".

Note

You are allowed to have a user on your blocked list and your friends list at the same time. However, you cannot trust a user who is on your blocked list.

Return type:

None

unblock()

Unblock the Redditor.

For example, to unblock Redditor u/spez:

reddit.redditor("spez").unblock()
Return type:

None

unfriend()

Unfriend the Redditor.

For example, to unfriend Redditor u/spez:

reddit.redditor("spez").unfriend()
Return type:

None

upvoted(**generator_kwargs)

Return a ListingGenerator for items the user has upvoted.

Return type:

Iterator[Comment | Submission]

Returns:

A ListingGenerator object which yields Comment or Submission objects the user has upvoted.

Raises:

prawcore.Forbidden if the user is not authorized to access the list.

Note

Since this function returns a ListingGenerator the exception may not occur until sometime after this function has returned.

Parameters:

generator_kwargs (str | int | dict[str, str])

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get all upvoted items of the authenticated user:

for item in reddit.user.me().upvoted():
    print(item.id)