WikiPage¶
-
class
asyncpraw.models.WikiPage(reddit: Reddit, subreddit: Subreddit, name: str, revision: Optional[str] = None, _data: Optional[Dict[str, Any]] = 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 complete.
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: Reddit, subreddit: Subreddit, name: str, revision: Optional[str] = None, _data: Optional[Dict[str, Any]] = None)¶ Construct an instance of the WikiPage object.
- Parameters
revision – A specific revision ID to fetch. By default, fetches the most recent revision.
-
await
edit(content: str, reason: Optional[str] = None, **other_settings: Any)¶ 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.
For example, to replace the first wiki page of
r/testwith the phrasetest wiki page:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("test", lazy=True) await page.edit(content="test wiki page")
-
await
load()¶ Re-fetches the object.
This is used to explicitly fetch or re-fetch the object from reddit. This method can be used on any
RedditBaseobject.await reddit_base_object.load()
-
mod¶ Provide an instance of
WikiPageModeration.For example, to add
spezas an editor on the wikipagepraw_testtry:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("praw_test", lazy=True) await page.mod.add("spez")
-
classmethod
parse(data: Dict[str, Any], reddit: Reddit) → Any¶ Return an instance of
clsfromdata.- Parameters
data – The structured data.
reddit – An instance of
Reddit.
-
await
revision(revision: str)¶ Return a specific version of this page by revision ID.
To view revision
[ID]of"praw_test"inr/test:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("praw_test", lazy=True) revision = await page.revision("[ID]")
-
revisions(**generator_kwargs: Union[str, int, Dict[str, str]]) → AsyncGenerator[asyncpraw.models.reddit.wikipage.WikiPage, None]¶ Return a
ListingGeneratorfor page revisions.Additional keyword arguments are passed in the initialization of
ListingGenerator.To view the wiki revisions for
"praw_test"inr/testtry:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("test_page", lazy=True) async for item in page.revisions(): print(item)
To get
WikiPageobjects for each revision:subreddit = await reddit.subreddit("test") page = await subreddit.wiki.get_page("test_page", lazy=True) async for item in page.revisions(): print(item["page"])
-
Note
This list of attributes is not complete. Async PRAW dynamically provides the attributes that Reddit returns via the API. Because those attributes are subject to change on Reddit’s end, Async PRAW makes no effort to document them, other than to instruct you on how to discover what is available. See Determine Available Attributes of an Object for detailed information.