SubredditWiki
- class praw.models.reddit.subreddit.SubredditWiki(subreddit: praw.models.Subreddit)
Provides a set of wiki functions to a
Subreddit
.- __getitem__(page_name: str) praw.models.reddit.wikipage.WikiPage
Lazily return the
WikiPage
for theSubreddit
namedpage_name
.This method is to be used to fetch a specific wikipage, like so:
wikipage = reddit.subreddit("test").wiki["proof"] print(wikipage.content_md)
- __init__(subreddit: praw.models.Subreddit)
Initialize a
SubredditWiki
instance.- Parameters
subreddit – The subreddit whose wiki to work with.
- __iter__() Generator[praw.models.reddit.wikipage.WikiPage, None, None]
Iterate through the pages of the wiki.
This method is to be used to discover all wikipages for a subreddit:
for wikipage in reddit.subreddit("test").wiki: print(wikipage)
- create(*, content: str, name: str, reason: Optional[str] = None, **other_settings: Any)
Create a new
WikiPage
.- Parameters
To create the wiki page
"praw_test"
in r/test try:reddit.subreddit("test").wiki.create( name="praw_test", content="wiki body text", reason="PRAW Test Creation" )
- revisions(**generator_kwargs: Any) Generator[Dict[str, Optional[Union[praw.models.Redditor, praw.models.reddit.wikipage.WikiPage, str, int, bool]]], None, 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"
in r/test try:for item in reddit.subreddit("test").wiki["praw_test"].revisions(): print(item)