WikiPage¶
-
class
praw.models.WikiPage(reddit, subreddit, name, revision=None, _data=None)¶ An individual WikiPage object.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor is this list necessarily comprehensive.
Attribute Description content_htmlThe contents of the wiki page, as HTML. content_mdThe contents of the wiki page, as Markdown. may_reviseA boolrepresenting whether or not the authenticated user may edit the wiki page.nameThe name of the wiki page. revision_byThe Redditorwho authored this revision of the wiki page.revision_dateThe time of this revision, in Unix Time. subredditThe Subredditthis wiki page belongs to.-
__init__(reddit, subreddit, name, revision=None, _data=None)¶ Construct an instance of the WikiPage object.
Parameters: revision – A specific revision ID to fetch. By default, fetches the most recent revision.
-
edit(content, reason=None, **other_settings)¶ Edit this WikiPage’s contents.
Parameters: - content – The updated markdown content of the page.
- reason – (Optional) The reason for the revision.
- other_settings – Additional keyword arguments to pass.
-
fullname¶ Return the object’s fullname.
A fullname is an object’s kind mapping like
t3followed by an underscore and the object’s base36 ID, e.g.,t1_c5s96e0.
-
mod¶ Provide an instance of
WikiPageModeration.
-
classmethod
parse(data, reddit)¶ Return an instance of
clsfromdata.Parameters: - data – The structured data.
- reddit – An instance of
Reddit.
-
revision(revision)¶ Return a specific version of this page by revision ID.
To view revision
[ID]of'praw_test'in'/r/test':page = reddit.subreddit('test').wiki['praw_test'].revision('[ID]')
-
revisions(**generator_kwargs)¶ Return a generator for page 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)
To get
WikiPageobjects for each revision:for item in reddit.subreddit('test').wiki['praw_test'].revisions(): print(item['page'])
-