ContributorRelationship

class praw.models.reddit.subreddit.ContributorRelationship(subreddit, relationship)

Provides methods to interact with a Subreddit’s contributors.

Contributors of a subreddit can be iterated through like so:

for contributor in reddit.subreddit('redditdev').contributor():
    print(contributor)
__call__(redditor=None, **generator_kwargs)

Return a generator for Redditors belonging to this relationship.

Parameters:redditor – When provided, yield at most a single Redditor instance. This is useful to confirm if a relationship exists, or to fetch the metadata associated with a particular relationship (default: None).

Additional keyword arguments are passed in the initialization of ListingGenerator.

__init__(subreddit, relationship)

Create a SubredditRelationship instance.

Parameters:
  • subreddit – The subreddit for the relationship.
  • relationship – The name of the relationship.
__iter__()

Iterate through the Redditors belonging to this relationship.

Warning

(Deprecated) This method will be removed in PRAW 5. Prefer calling subreddit.banned(limit=None) instead of subreddit.banned and similar for other relationships.

add(redditor, **other_settings)

Add redditor to this relationship.

Parameters:redditor – A redditor name (e.g., 'spez') or Redditor instance.
leave()

Abdicate the contributor position.

remove(redditor)

Remove redditor from this relationship.

Parameters:redditor – A redditor name (e.g., 'spez') or Redditor instance.