Skip to content
alexz-enwp edited this page Jan 1, 2015 · 4 revisions

page.py is a module that contains classes and functions for working with pages on wikis.

Objects

page.py defines 1 object

Page

A Page object represents a page on the wiki. It contains information on the title and namespace and can be used to retrieve information about it such as the page content and categories. See page.Page for complete documentation and examples.

Exceptions

page.py defines 5 exceptions

BadTitle

BadTitle is a subclass of wiki.WikiError and is raised when trying to create a Page with an invalid title. See MW Docs for more information.

NoPage

NoPage is a subclass of wiki.WikiError and is raised when calling certain functions of the Page object when the page doesn't exist on the wiki, such as trying to get the links or wikitext of a non-existent page.

BadNamespace

BadNamespace is a subclass of wiki.WikiError and is raised when trying to set a namespace number that doesn't exist on the wiki

EditError

EditError is a subclass of wiki.WikiError and is raised when an invalid combination of parameters is passed to Page.edit()

ProtectError

ProtectError is a subclass of wiki.WikiError and is raised when when an invalid combination of parameters is passed to Page.protect()

Functions

namespaceDetect

namespaceDetect(title, site)

Given a page title and a wiki object, determines the namespace without needing to do any API queries. Returns the integer corresponding to the namespace.

Clone this wiki locally