SubredditWiki¶
- class asyncpraw.models.reddit.subreddit.SubredditWiki(subreddit: asyncpraw.models.Subreddit)¶
Provides a set of wiki functions to a Subreddit.
- __init__(subreddit: asyncpraw.models.Subreddit)¶
Create a SubredditWiki instance.
- Parameters
subreddit – The subreddit whose wiki to work with.
- await create(name: str, content: str, reason: Optional[str] = None, **other_settings: Any)¶
Create a new wiki page.
- Parameters
name – The name of the new WikiPage. This name will be normalized.
content – The content of the new WikiPage.
reason – (Optional) The reason for the creation.
other_settings – Additional keyword arguments to pass.
To create the wiki page
praw_test
inr/test
try:subreddit = await reddit.subreddit("test") await subreddit.wiki.create("praw_test", "wiki body text", reason="PRAW Test Creation")
- await get_page(page_name, lazy=False) asyncpraw.models.reddit.wikipage.WikiPage ¶
Return the WikiPage for the subreddit named
page_name
.Set
lazy=True
to skip fetching the wiki page.This method is to be used to fetch a specific wikipage, like so:
subreddit = await reddit.subreddit("iama") wikipage = await subreddit.wiki.get_page("proof") print(wikipage.content_md)
- revisions(**generator_kwargs: Any) AsyncGenerator[Dict[str, Optional[Union[asyncpraw.models.Redditor, asyncpraw.models.reddit.wikipage.WikiPage, str, int, bool]]], None] ¶
Return a
ListingGenerator
for recent wiki revisions.Additional keyword arguments are passed in the initialization of
ListingGenerator
.To view the wiki revisions for
"praw_test"
inr/test
try:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("praw_test") async for item in page.revisions(): print(item)