SubredditWiki¶
-
class
praw.models.reddit.subreddit.
SubredditWiki
(subreddit)¶ Provides a set of wiki functions to a Subreddit.
-
__getitem__
(page_name)¶ Lazily return the WikiPage for the subreddit named
page_name
.This method is to be used to fetch a specific wikipage, like so:
wikipage = reddit.subreddit('iama').wiki['proof'] print(wikipage.content_md)
-
__init__
(subreddit)¶ Create a SubredditWiki instance.
Parameters: subreddit – The subreddit whose wiki to work with.
-
__iter__
()¶ 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('iama').wiki: print(wikipage)
-
create
(name, content, reason=None, **other_settings)¶ 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:reddit.subreddit('test').wiki.create( 'praw_test', 'wiki body text', reason='PRAW Test Creation')
-
revisions
(**generator_kwargs)¶ 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:for item in reddit.subreddit('test').wiki['praw_test'].revisions(): print(item)
-