reddit.subreddit¶
- class asyncpraw.models.SubredditHelper(reddit: asyncpraw.Reddit, _data: dict[str, Any] | None)¶
Provide a set of functions to interact with Subreddits.
- await __call__(display_name: str, fetch: bool = False) asyncpraw.models.Subreddit ¶
Return an instance of
Subreddit
.- Parameters:
display_name – The name of the subreddit.
fetch – Determines if Async PRAW will fetch the object (default:
False
).
If you need the object fetched right away (e.g., to access an attribute) you can do:
subreddit = await reddit.subreddit("test", fetch=True) print(subreddit.subscribers)
- __init__(reddit: asyncpraw.Reddit, _data: dict[str, Any] | None)¶
Initialize a
AsyncPRAWBase
instance.- Parameters:
reddit – An instance of
Reddit
.
- await create(name: str, *, link_type: str = 'any', subreddit_type: str = 'public', title: str | None = None, wikimode: str = 'disabled', **other_settings: str | None) asyncpraw.models.Subreddit ¶
Create a new
Subreddit
.- Parameters:
name – The name for the new subreddit.
link_type – The types of submissions users can make. One of
"any"
,"link"
, or"self"
(default:"any"
).subreddit_type – One of
"archived"
,"employees_only"
,"gold_only"
,"gold_restricted"
,"private"
,"public"
, or"restricted"
(default:"public"
).title – The title of the subreddit. When
None
or""
use the value ofname
.wikimode – One of
"anyone"
,"disabled"
, or"modonly"
(default:"disabled"
).
Any keyword parameters not provided, or set explicitly to
None
, will take on a default value assigned by the Reddit server.See also
update()
for documentation of other available settings.
- classmethod parse(data: dict[str, Any], reddit: asyncpraw.Reddit) AsyncPRAWBase ¶
Return an instance of
cls
fromdata
.- Parameters:
data – The structured data.
reddit – An instance of
Reddit
.