Page
A Page object represents a page on a site, including mainspace pages, project pages, category and file description pages, interface pages, and so on. It has two subclasses, Category and Image, for categories and files in particular. Page objects are most easily retrieved from the Site.Pages collection:
page = site.Pages['Apple']
Once retrieved, the most common operation to perform with a page is to edit it, as in this example that moves a page from one category to another:
text = page.text()
text = text.replace('<nowiki>[[Category:Apples]]</nowiki>', '<nowiki>[[Category:Pears]]</nowiki>')
page.save(text, summary='Moved from category Apples to category Pears')
Deletion, moving, and purging of pages is also supported. Many lists related to a page can be retrieved, such as links to and from a page, categories, and the revision history. Many properties of the page are available through its public data members.
- _repr_
- _unicode_
- strip_namespace (static)
- normalize_title (static)
- get_token
- handle_edit_error
- site
- name
- namespace
- touched
- revision
- exists
- length
- protection
- redirect
- last_rev_time
- edit_time
- pageid
This page was originally imported from the old mwclient wiki at SourceForge. The imported version was dated from 01:54, 6 February 2012, and its only editor was Derrickcoetzee (@dcoetzee).
- Querying Wikipedia with mwclient
- Replacing a string for every page in a category
- Creating a page listing all pages in a category
Note: the red links below are pages yet to be created. Feel free to add them!