Page

class mwklient.page.Page(site, name, info=None, extra_properties=None)[source]
can(action)[source]

Check if the current user has the right to carry out some action with the current page.

Example

>>> page.can('edit')
True
cannot(action)[source]

Check if the current user has not the right to carry out some action with the current page.

Example

>>> page.cannot('edit')
True
purge()[source]

Purge server-side cache of page. This will re-render templates and other dynamic content.

redirects_to()[source]

Returns the redirect target page, or None if the page is not a redirect page.

resolve_redirect()[source]

Returns the redirect target page, or the current page if it’s not a redirect page.

revisions(startid=None, endid=None, start=None, end=None, direc='older', user=None, excludeuser=None, limit=50, prop='ids|timestamp|flags|comment|user', expandtemplates=False, section=None, diffto=None, slots=None, uselang=None)[source]

List revisions of the current page.

API doc: https://www.mediawiki.org/wiki/API:Revisions

Parameters:
  • startid (int) – Revision ID to start listing from.
  • endid (int) – Revision ID to stop listing at.
  • start (str) – Timestamp to start listing from.
  • end (str) – Timestamp to end listing at.
  • direc (str) – Direction to list in: ‘older’ (default) or ‘newer’.
  • user (str) – Only list revisions made by this user.
  • excludeuser (str) – Exclude revisions made by this user.
  • limit (int) – The maximum number of revisions to return per request.
  • prop (str) – Which properties to get for each revision, default: ‘ids|timestamp|flags|comment|user’
  • expandtemplates (bool) – Expand templates in rvprop=content output
  • section (int) – If rvprop=content is set, only retrieve the contents
  • this section. (of) –
  • diffto (str) – Revision ID to diff each revision to. Use “prev”, “next” and “cur” for the previous, next and current revision respectively.
  • slots (str) – The content slot (Mediawiki >= 1.32) to retrieve content from.
  • uselang (str) – Language to use for parsed edit comments and other localized messages.
Returns:

Revision iterator

Return type:

mwklient.listings.List

class mwklient.listing.Category(site, name, info=None, namespace=None)[source]