SubredditRelationship¶
- class praw.models.reddit.subreddit.SubredditRelationship(subreddit: praw.models.Subreddit, relationship: str)¶
Represents a relationship between a
RedditorandSubreddit.Instances of this class can be iterated through in order to discover the Redditors that make up the relationship.
For example, banned users of a subreddit can be iterated through like so:
for ban in reddit.subreddit("test").banned(): print(f"{ban}: {ban.note}")
- __call__(redditor: praw.models.Redditor | str | None = None, **generator_kwargs) Iterator[praw.models.Redditor]¶
Return a
ListingGeneratorforRedditors in the relationship.- Parameters:
redditor – When provided, yield at most a single
Redditorinstance. 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: praw.models.Subreddit, relationship: str)¶
Initialize a
SubredditRelationshipinstance.- Parameters:
subreddit – The
Subredditfor the relationship.relationship – The name of the relationship.
- add(redditor: str | praw.models.Redditor, **other_settings: Any)¶
Add
redditorto this relationship.- Parameters:
redditor – A redditor name or
Redditorinstance.
- remove(redditor: str | praw.models.Redditor)¶
Remove
redditorfrom this relationship.- Parameters:
redditor – A redditor name or
Redditorinstance.