reddit.subreddit¶
- class asyncpraw.models.SubredditHelper(reddit: asyncpraw.Reddit, _data: Optional[Dict[str, Any]])¶
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
.If you need the object fetched right away (e.g., to access an attribute) you can do:
multireddit = await reddit.subreddit("redditor", fetch=True) async for comment in multireddit.comments(limit=25): print(comment.author)
- Parameters
display_name – The name of the subreddit.
fetch – Determines if the object is lazily loaded (default: False).
- __init__(reddit: asyncpraw.Reddit, _data: Optional[Dict[str, Any]])¶
Initialize a PRAWModel instance.
- Parameters
reddit – An instance of
Reddit
.
- await create(name: str, title: Optional[str] = None, link_type: str = 'any', subreddit_type: str = 'public', wikimode: str = 'disabled', **other_settings: Optional[str]) asyncpraw.models.Subreddit ¶
Create a new subreddit.
- Parameters
name – The name for the new subreddit.
title – The title of the subreddit. When
None
or""
use the value ofname
.link_type – The types of submissions users can make. One of
any
,link
,self
(default: any).subreddit_type – One of
archived
,employees_only
,gold_only
,gold_restricted
,private
,public
,restricted
(default: public).wikimode – One of
anyone
,disabled
,modonly
.
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) Any ¶
Return an instance of
cls
fromdata
.- Parameters
data – The structured data.
reddit – An instance of
Reddit
.