Help on class Category in module pywikibot.page:
class Category(Page)
| A page in the Category: namespace.
|
| Method resolution order:
| Category
| Page
| BasePage
| pywikibot.tools.ComparableMixin
| builtins.object
|
| Methods defined here:
|
| __init__(self, source, title='', sort_key=None, insite=NotImplemented, sortKey='[deprecated name of sort_key]')
| Initializer.
|
| All parameters are the same as for Page() Initializer.
|
| articles(self, recurse=False, total=None, content=False, namespaces=None, sortby=None, reverse=False, starttime=None, endtime=None, startsort=None, endsort=None, startprefix=None, endprefix=None, startFrom='[deprecated name of startprefix]', step=NotImplemented)
| Yield all articles in the current category.
|
| By default, yields all *pages* in the category that are not
| subcategories!
|
| @param recurse: if not False or 0, also iterate articles in
| subcategories. If an int, limit recursion to this number of
| levels. (Example: recurse=1 will iterate articles in first-level
| subcats, but no deeper.)
| @type recurse: int or bool
| @param total: iterate no more than this number of pages in
| total (at all levels)
| @param namespaces: only yield pages in the specified namespaces
| @type namespaces: int or list of ints
| @param content: if True, retrieve the content of the current version
| of each page (default False)
| @param sortby: determines the order in which results are generated,
| valid values are "sortkey" (default, results ordered by category
| sort key) or "timestamp" (results ordered by time page was
| added to the category). This applies recursively.
| @type sortby: str
| @param reverse: if True, generate results in reverse order
| (default False)
| @param starttime: if provided, only generate pages added after this
| time; not valid unless sortby="timestamp"
| @type starttime: pywikibot.Timestamp
| @param endtime: if provided, only generate pages added before this
| time; not valid unless sortby="timestamp"
| @type endtime: pywikibot.Timestamp
| @param startsort: if provided, only generate pages that have a
| sortkey >= startsort; not valid if sortby="timestamp"
| (Deprecated in MW 1.24)
| @type startsort: str
| @param endsort: if provided, only generate pages that have a
| sortkey <= endsort; not valid if sortby="timestamp"
| (Deprecated in MW 1.24)
| @type endsort: str
| @param startprefix: if provided, only generate pages >= this title
| lexically; not valid if sortby="timestamp"; overrides "startsort"
| (requires MW 1.18+)
| @type startprefix: str
| @param endprefix: if provided, only generate pages < this title
| lexically; not valid if sortby="timestamp"; overrides "endsort"
| (requires MW 1.18+)
| @type endprefix: str
| @rtype: typing.Iterable[pywikibot.Page]
|
| aslink(self, sort_key=None, forceInterwiki=NotImplemented, textlink=NotImplemented, noInterwiki=NotImplemented, sortKey='[deprecated name of sort_key]')
| Return a link to place a page in this Category.
|
| Use this only to generate a "true" category link, not for interwikis
| or text links to category pages.
|
| @param sort_key: The sort key for the article to be placed in this
| Category; if omitted, default sort key is used.
| @type sort_key: (optional) str
|
| isEmptyCategory(self)
| Return True if category has no members (including subcategories).
|
| @rtype: bool
|
| isHiddenCategory(self)
| Return True if the category is hidden.
|
| @rtype: bool
|
| members(self, recurse=False, namespaces=None, total=None, content=False, step=NotImplemented)
| Yield all category contents (subcats, pages, and files).
|
| @rtype: typing.Iterable[pywikibot.Page]
|
| newest_pages(self, total=None)
| Return pages in a category ordered by the creation date.
|
| If two or more pages are created at the same time, the pages are
| returned in the order they were added to the category. The most
| recently added page is returned first.
|
| It only allows to return the pages ordered from newest to oldest, as it
| is impossible to determine the oldest page in a category without
| checking all pages. But it is possible to check the category in order
| with the newly added first and it yields all pages which were created
| after the currently checked page was added (and thus there is no page
| created after any of the cached but added before the currently
| checked).
|
| @param total: The total number of pages queried.
| @type total: int
| @return: A page generator of all pages in a category ordered by the
| creation date. From newest to oldest. Note: It currently only
| returns Page instances and not a subclass of it if possible. This
| might change so don't expect to only get Page instances.
| @rtype: generator
|
| subcategories(self, recurse=False, total=None, content=False, startFrom=NotImplemented, cacheResults=NotImplemented, step=NotImplemented)
| Iterate all subcategories of the current category.
|
| @param recurse: if not False or 0, also iterate subcategories of
| subcategories. If an int, limit recursion to this number of
| levels. (Example: recurse=1 will iterate direct subcats and
| first-level sub-sub-cats, but no deeper.)
| @type recurse: int or bool
| @param total: iterate no more than this number of
| subcategories in total (at all levels)
| @param content: if True, retrieve the content of the current version
| of each category description page (default False)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| categoryinfo
| Return a dict containing information about the category.
|
| The dict contains values for:
|
| Numbers of pages, subcategories, files, and total contents.
|
| @rtype: dict
|
| ----------------------------------------------------------------------
| Methods inherited from Page:
|
| set_redirect_target(self, target_page, create=False, force=False, keep_section=False, save=True, **kwargs)
| Change the page's text to point to the redirect page.
|
| @param target_page: target of the redirect, this argument is required.
| @type target_page: pywikibot.Page or string
| @param create: if true, it creates the redirect even if the page
| doesn't exist.
| @type create: bool
| @param force: if true, it set the redirect target even the page
| doesn't exist or it's not redirect.
| @type force: bool
| @param keep_section: if the old redirect links to a section
| and the new one doesn't it uses the old redirect's section.
| @type keep_section: bool
| @param save: if true, it saves the page immediately.
| @type save: bool
| @param kwargs: Arguments which are used for saving the page directly
| afterwards, like 'summary' for edit summary.
|
| templatesWithParams(self, get_redirect=NotImplemented)
| Return templates used on this Page.
|
| The templates are extracted by L{textlib.extract_templates_and_params},
| with positional arguments placed first in order, and each named
| argument appearing as 'name=value'.
|
| All parameter keys and values for each template are stripped of
| whitespace.
|
| @return: a list of tuples with one tuple for each template invocation
| in the page, with the template Page as the first entry and a list
| of parameters as the second entry.
| @rtype: list of (pywikibot.page.Page, list)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Page:
|
| raw_extracted_templates
| Extract templates using L{textlib.extract_templates_and_params}.
|
| Disabled parts and whitespace are stripped, except for
| whitespace in anonymous positional arguments.
|
| This value is cached.
|
| @rtype: list of (str, OrderedDict)
|
| ----------------------------------------------------------------------
| Methods inherited from BasePage:
|
| __hash__(self)
| A stable identifier to be used as a key in hash-tables.
|
| This relies on the fact that the string
| representation of an instance cannot change after the construction.
|
| __repr__(self)
| Return a more complete string representation.
|
| __str__(self)
| Return a string representation.
|
| applicable_protections(self) -> set
| Return the protection types allowed for that page.
|
| If the page doesn't exist it only returns "create". Otherwise it
| returns all protection types provided by the site, except "create".
| It also removes "upload" if that page is not in the File namespace.
|
| It is possible, that it returns an empty set, but only if original
| protection types were removed.
|
| @return: set of str
|
| autoFormat(self)
| Return L{date.getAutoFormat} dictName and value, if any.
|
| Value can be a year, date, etc., and dictName is 'YearBC',
| 'Year_December', or another dictionary name. Please note that two
| entries may have exactly the same autoFormat, but be in two
| different namespaces, as some sites have categories with the
| same names. Regular titles return (None, None).
|
| backlinks(self, follow_redirects=True, filter_redirects=None, namespaces=None, total=None, content=False, step=NotImplemented, followRedirects='[deprecated name of follow_redirects]', filterRedirects='[deprecated name of filter_redirects]')
| Return an iterator for pages that link to this page.
|
| @param follow_redirects: if True, also iterate pages that link to a
| redirect pointing to the page.
| @param filter_redirects: if True, only iterate redirects; if False,
| omit redirects; if None, do not filter
| @param namespaces: only iterate pages in these namespaces
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each referring page (default False)
|
| botMayEdit(self)
| Determine whether the active bot is allowed to edit the page.
|
| This will be True if the page doesn't contain {{bots}} or {{nobots}}
| or any other template from edit_restricted_templates list
| in x_family.py file, or it contains them and the active bot is allowed
| to edit this page. (This method is only useful on those sites that
| recognize the bot-exclusion protocol; on other sites, it will always
| return True.)
|
| The framework enforces this restriction by default. It is possible
| to override this by setting ignore_bot_templates=True in
| user-config.py, or using page.put(force=True).
|
| @rtype: bool
|
| canBeEdited(self)
| DEPRECATED. Determine whether the page may be edited.
|
| categories(self, with_sort_key=False, total=None, content=False, nofollow_redirects=NotImplemented, get_redirect=NotImplemented, step=NotImplemented, withSortKey='[deprecated name of with_sort_key]')
| Iterate categories that the article is in.
|
| @param with_sort_key: if True, include the sort key in each Category.
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each category description page (default False)
| @return: a generator that yields Category objects.
| @rtype: generator
|
| change_category(self, old_cat, new_cat, summary=None, sort_key=None, in_place=True, include=[], comment='[deprecated name of summary]', oldCat='[deprecated name of old_cat]', newCat='[deprecated name of new_cat]', sortKey='[deprecated name of sort_key]', inPlace='[deprecated name of in_place]')
| Remove page from oldCat and add it to newCat.
|
| @param old_cat: category to be removed
| @type old_cat: pywikibot.page.Category
| @param new_cat: category to be added, if any
| @type new_cat: pywikibot.page.Category or None
|
| @param summary: string to use as an edit summary
|
| @param sort_key: sortKey to use for the added category.
| Unused if newCat is None, or if inPlace=True
| If sortKey=True, the sortKey used for oldCat will be used.
|
| @param in_place: if True, change categories in place rather than
| rearranging them.
|
| @param include: list of tags not to be disabled by default in relevant
| textlib functions, where CategoryLinks can be searched.
| @type include: list
|
| @return: True if page was saved changed, otherwise False.
| @rtype: bool
|
| clear_cache(self)
| Clear the cached attributes of the page.
|
| contributingUsers(self, total=None, step=NotImplemented)
| Deprecated; use contributors() instead.
|
|
| Return a set of usernames (or IPs) of users who edited this page.
|
| @param total: iterate no more than this number of revisions in total
|
| @rtype: set
|
| contributors(self, total=None, starttime=None, endtime=None, step=NotImplemented)
| Compile contributors of this page with edit counts.
|
| @param total: iterate no more than this number of revisions in total
| @param starttime: retrieve revisions starting at this Timestamp
| @param endtime: retrieve revisions ending at this Timestamp
|
| @return: number of edits for each username
| @rtype: L{collections.Counter}
|
| coordinates(self, primary_only=False)
| Return a list of Coordinate objects for points on the page.
|
| Uses the MediaWiki extension GeoData.
|
| @param primary_only: Only return the coordinate indicated to be primary
| @return: A list of Coordinate objects or a single Coordinate if
| primary_only is True
| @rtype: list of Coordinate or Coordinate or None
|
| create_short_link(self, permalink=False, with_protocol=True)
| Return a shortened link that points to that page.
|
| If shared_urlshortner_wiki is defined in family config, it'll use
| that site to create the link instead of the current wiki.
|
| @param permalink: If true, the link will point to the actual revision
| of the page.
| @type permalink: bool
| @param with_protocol: If true, and if it's not already included,
| the link will have http(s) protocol prepended. On Wikimedia wikis
| the protocol is already present.
| @type with_protocol: bool
| @return: The reduced link.
| @rtype: str
|
| data_item(self)
| Convenience function to get the Wikibase item of a page.
|
| @rtype: pywikibot.page.ItemPage
|
| defaultsort(self, force=False)
| Extract value of the {{DEFAULTSORT:}} magic word from the page.
|
| @param force: force updating from the live site
|
| @rtype: str or None
|
| delete(self, reason=None, prompt=True, mark=False, quit=False, throttle=NotImplemented)
| Delete the page from the wiki. Requires administrator status.
|
| @param reason: The edit summary for the deletion, or rationale
| for deletion if requesting. If None, ask for it.
| @param prompt: If true, prompt user for confirmation before deleting.
| @param mark: If true, and user does not have sysop rights, place a
| speedy-deletion request on the page instead. If false, non-sysops
| will be asked before marking pages for deletion.
| @param quit: show also the quit option, when asking for confirmation.
|
| editTime(self)
| Return timestamp of last revision to page.
|
| @rtype: pywikibot.Timestamp
|
| embeddedin(self, filter_redirects=None, namespaces=None, total=None, content=False, step=NotImplemented)
| Return an iterator for pages that embed this page as a template.
|
| @param filter_redirects: if True, only iterate redirects; if False,
| omit redirects; if None, do not filter
| @param namespaces: only iterate pages in these namespaces
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each embedding page (default False)
|
| exists(self)
| Return True if page exists on the wiki, even if it's a redirect.
|
| If the title includes a section, return False if this section isn't
| found.
|
| @rtype: bool
|
| expand_text(self, force=False, includecomments=False, refresh='[deprecated name of force]')
| Return the page text with all templates and parser words expanded.
|
| @param force: force updating from the live site
| @param includecomments: Also strip comments if includecomments
| parameter is not True.
|
| extlinks(self, total=None, step=NotImplemented)
| Iterate all external URLs (not interwiki links) from this page.
|
| @param total: iterate no more than this number of pages in total
| @return: a generator that yields str objects containing URLs.
| @rtype: generator
|
| fullVersionHistory(self, reverse=False, total=None, reverseOrder='[deprecated name of reverse]', rollback=NotImplemented, step=NotImplemented)
| Deprecated; use Page.revisions(content=True) instead.
|
| Return previous versions including content.
|
| full_url(self)
| Return the full URL.
|
| get(self, force=False, get_redirect=False, throttle=NotImplemented, change_edit_time=NotImplemented, expandtemplates=NotImplemented)
| Return the wiki-text of the page.
|
| This will retrieve the page from the server if it has not been
| retrieved yet, or if force is True. This can raise the following
| exceptions that should be caught by the calling code:
|
| @exception pywikibot.exceptions.NoPage: The page does not exist
| @exception pywikibot.exceptions.IsRedirectPage: The page is a redirect.
| The argument of the exception is the title of the page it
| redirects to.
| @exception pywikibot.exceptions.SectionError: The section does not
| exist on a page with a # link
|
| @param force: reload all page attributes, including errors.
| @param get_redirect: return the redirect text, do not follow the
| redirect, do not raise an exception.
| @rtype: str
|
| getCategoryRedirectTarget(self)
| If this is a category redirect, return the target category title.
|
| @rtype: pywikibot.page.Category
|
| getCreator(self)
| Get the first revision of the page.
|
| DEPRECATED: Use Page.oldest_revision.
|
| @return: tuple of username and timestamp in isoformat
| @rtype: tuple[str]
|
| getDeletedRevision(self, timestamp, content=False, retrieveText='[deprecated name of content]')
| Return a particular deleted revision by timestamp.
|
| @return: a list of [date, editor, comment, text, restoration
| marker]. text will be None, unless content is True (or has
| been retrieved earlier). If timestamp is not found, returns
| empty list.
| @rtype: list
|
| getLatestEditors(self, total=1, limit='[deprecated name of total]')
| Get a list of revision information of the last total edits.
|
| DEPRECATED: Use Page.revisions.
|
| @param total: iterate no more than this number of revisions in total
| @return: list of dict, each dict containing the username and Timestamp
|
| getMovedTarget(self)
| Return a Page object for the target this Page was moved to.
|
| DEPRECATED: Use Page.moved_target().
|
| If this page was not moved, it will raise a NoPage exception.
| This method also works if the source was already deleted.
|
| @rtype: pywikibot.page.Page
| @raises pywikibot.exceptions.NoPage: this page was not moved
|
| getOldVersion(self, oldid, force=False, get_redirect=False, throttle=NotImplemented, change_edit_time=NotImplemented)
| Return text of an old revision of this page; same options as get().
|
| @param oldid: The revid of the revision desired.
| @rtype: str
|
| getRedirectTarget(self)
| Return a Page object for the target this Page redirects to.
|
| If this page is not a redirect page, will raise an IsNotRedirectPage
| exception. This method also can raise a NoPage exception.
|
| @rtype: pywikibot.Page
|
| getReferences(self, follow_redirects=True, with_template_inclusion=True, only_template_inclusion=False, filter_redirects=False, namespaces=None, total=None, content=False, step=NotImplemented, withTemplateInclusion='[deprecated name of with_template_inclusion]', onlyTemplateInclusion='[deprecated name of only_template_inclusion]', redirectsOnly='[deprecated name of filter_redirects]')
| Return an iterator all pages that refer to or embed the page.
|
| If you need a full list of referring pages, use
| C{pages = list(s.getReferences())}
|
| @param follow_redirects: if True, also iterate pages that link to a
| redirect pointing to the page.
| @param with_template_inclusion: if True, also iterate pages where self
| is used as a template.
| @param only_template_inclusion: if True, only iterate pages where self
| is used as a template.
| @param filter_redirects: if True, only iterate redirects to self.
| @param namespaces: only iterate pages in these namespaces
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each referring page (default False)
| @rtype: typing.Iterable[pywikibot.Page]
|
| getRestrictions(self)
| DEPRECATED. Use self.protection() instead.
|
| getTemplates(self, tllimit=NotImplemented)
| DEPRECATED. Use templates().
|
| getVersionHistory(self, reverse=False, total=None, forceReload=NotImplemented, revCount='[deprecated name of total]', step=NotImplemented, getAll=NotImplemented, reverseOrder='[deprecated name of reverse]')
| Deprecated; use Page.revisions() instead.
|
|
| Load the version history page and return history information.
|
| Return value is a list of tuples, where each tuple represents one
| edit and is built of revision id, edit date/time, user name, and
| edit summary. Starts with the most current revision, unless
| reverse is True.
|
| @param total: iterate no more than this number of revisions in total
|
| getVersionHistoryTable(self, reverse=False, total=None, forceReload=NotImplemented, reverseOrder='[deprecated name of reverse]', step=NotImplemented)
| Return the version history as a wiki table.
|
| has_permission(self, action='edit')
| Determine whether the page can be modified.
|
| Return True if the bot has the permission of needed restriction level
| for the given action type.
|
| @param action: a valid restriction type like 'edit', 'move'
| @type action: str
| @rtype: bool
|
| @raises ValueError: invalid action parameter
|
| imagelinks(self, total=None, content=False, followRedirects=NotImplemented, loose=NotImplemented, step=NotImplemented)
| Iterate FilePage objects for images displayed on this Page.
|
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each image description page (default False)
| @return: a generator that yields FilePage objects.
|
| interwiki(self, expand=True)
| Iterate interwiki links in the page text, excluding language links.
|
| @param expand: if True (default), include interwiki links found in
| templates transcluded onto this page; if False, only iterate
| interwiki links found in this page's own wikitext
| @type expand: bool
|
| @return: a generator that yields Link objects
| @rtype: generator
|
| isAutoTitle(self)
| Return True if title of this Page is in the autoFormat dict.
|
| isCategory(self)
| DEPRECATED: use is_categorypage instead.
|
| isCategoryRedirect(self)
| Return True if this is a category redirect page, False otherwise.
|
| @rtype: bool
|
| isDisambig(self)
| Return True if this is a disambiguation page, False otherwise.
|
| By default, it uses the the Disambiguator extension's result. The
| identification relies on the presence of the __DISAMBIG__ magic word
| which may also be transcluded.
|
| If the Disambiguator extension isn't activated for the given site,
| the identification relies on the presence of specific templates.
| First load a list of template names from the Family file;
| if the value in the Family file is None or no entry was made, look for
| the list on [[MediaWiki:Disambiguationspage]]. If this page does not
| exist, take the MediaWiki message. 'Template:Disambig' is always
| assumed to be default, and will be appended regardless of its
| existence.
|
| @rtype: bool
|
| isEmpty(self)
| Deprecated.
|
|
| Return True if the page text has less than 4 characters.
|
| Character count ignores language links and category links.
| Can raise the same exceptions as get().
|
| @rtype: bool
|
| isFlowPage(self)
| DEPRECATED: use self.is_flow_page instead.
|
| isImage(self)
| DEPRECATED: use is_filepage instead.
|
| isIpEdit(self)
| Return True if last editor was unregistered.
|
| @rtype: bool
|
| isRedirectPage(self)
| Return True if this is a redirect, False if not or not existing.
|
| isStaticRedirect(self, force=False)
| Determine whether the page is a static redirect.
|
| A static redirect must be a valid redirect, and contain the magic word
| __STATICREDIRECT__.
|
| @param force: Bypass local caching
| @type force: bool
|
| @rtype: bool
|
| isTalkPage(self)
| Return True if this page is in any talk namespace.
|
| is_categorypage(self)
| Return True if the page is a Category, False otherwise.
|
| is_filepage(self)
| Return True if this is an file description page, False otherwise.
|
| is_flow_page(self)
| Whether a page is a Flow page.
|
| @rtype: bool
|
| iterlanglinks(self, total=None, include_obsolete=False, step=NotImplemented)
| Iterate all inter-language links on this page.
|
| @param total: iterate no more than this number of pages in total
| @param include_obsolete: if true, yield even Link object whose site
| is obsolete
| @type include_obsolete: bool
|
| @return: a generator that yields Link objects.
| @rtype: generator
|
| itertemplates(self, total=None, content=False, step=NotImplemented)
| Iterate Page objects for templates used on this Page.
|
| Template parameters are ignored. This method only returns embedded
| templates, not template pages that happen to be referenced through
| a normal link.
|
| @param total: iterate no more than this number of pages in total
| @param content: if True, retrieve the content of the current version
| of each template (default False)
| @param content: bool
|
| langlinks(self, include_obsolete=False)
| Return a list of all inter-language Links on this page.
|
| @param include_obsolete: if true, return even Link objects whose site
| is obsolete
| @type include_obsolete: bool
|
| @return: list of Link objects.
| @rtype: list
|
| lastNonBotUser(self)
| Return name or IP address of last human/non-bot user to edit page.
|
| Determine the most recent human editor out of the last revisions.
| If it was not able to retrieve a human user, returns None.
|
| If the edit was done by a bot which is no longer flagged as 'bot',
| i.e. which is not returned by Site.botusers(), it will be returned
| as a non-bot edit.
|
| @rtype: str
|
| latestRevision(self)
| Deprecated; use latest_revision_id instead.
|
| Return the current revision id for this page.
|
| linkedPages(self, namespaces=None, total=None, content=False, step=NotImplemented)
| Iterate Pages that this Page links to.
|
| Only returns pages from "normal" internal links. Image and category
| links are omitted unless prefixed with ":". Embedded templates are
| omitted (but links within them are returned). All interwiki and
| external links are omitted.
|
| @param namespaces: only iterate links in these namespaces
| @param namespaces: int, or list of ints
| @param total: iterate no more than this number of pages in total
| @type total: int
| @param content: if True, retrieve the content of the current version
| of each linked page (default False)
| @type content: bool
|
| @return: a generator that yields Page objects.
| @rtype: generator
|
| loadDeletedRevisions(self, total=None, step=NotImplemented)
| Retrieve deleted revisions for this Page.
|
| Stores all revisions' timestamps, dates, editors and comments in
| self._deletedRevs attribute.
|
| @return: iterator of timestamps (which can be used to retrieve
| revisions later on).
| @rtype: generator
|
| markDeletedRevision(self, timestamp, undelete=True)
| Mark the revision identified by timestamp for undeletion.
|
| @param undelete: if False, mark the revision to remain deleted.
| @type undelete: bool
|
| merge_history(self, dest, timestamp=None, reason=None)
| Merge revisions from this page into another page.
|
| See L{APISite.merge_history} for details.
|
| @param dest: Destination page to which revisions will be merged
| @type dest: pywikibot.Page
| @param timestamp: Revisions from this page dating up to this timestamp
| will be merged into the destination page (if not given or False,
| all revisions will be merged)
| @type timestamp: pywikibot.Timestamp
| @param reason: Optional reason for the history merge
| @type reason: str
|
| move(self, newtitle, reason=None, movetalk=True, noredirect=False, throttle=NotImplemented, deleteAndMove='[deprecated name of noredirect]', movetalkpage='[deprecated name of movetalk]')
| Move this page to a new title.
|
| @param newtitle: The new page title.
| @param reason: The edit summary for the move.
| @param movetalk: If true, move this page's talk page (if it exists)
| @param noredirect: if move succeeds, delete the old page
| (usually requires sysop privileges, depending on wiki settings)
|
| moved_target(self)
| Return a Page object for the target this Page was moved to.
|
| If this page was not moved, it will raise a NoMoveTarget exception.
| This method also works if the source was already deleted.
|
| @rtype: pywikibot.page.Page
| @raises pywikibot.exceptions.NoMoveTarget: this page was not moved
|
| namespace(self)
| Return the namespace of the page.
|
| @return: namespace of the page
| @rtype: pywikibot.Namespace
|
| pageAPInfo(self)
| Deprecated; use latest_revision_id instead.
|
| Return the current revision id for this page.
|
| page_image(self)
| Return the most appropriate image on the page.
|
| Uses the MediaWiki extension PageImages.
|
| @return: A FilePage object
| @rtype: pywikibot.page.FilePage
|
| permalink(self, oldid=None, percent_encoded=True, with_protocol=False)
| Return the permalink URL of an old revision of this page.
|
| @param oldid: The revid of the revision desired.
| @param percent_encoded: if false, the link will be provided
| without title uncoded.
| @param with_protocol: if true, http or https prefixes will be
| included before the double slash.
| @rtype: str
|
| preloadText(self)
| The text returned by EditFormPreloadText.
|
| See API module "info".
|
| Application: on Wikisource wikis, text can be preloaded even if
| a page does not exist, if an Index page is present.
|
| @rtype: str
|
| previousRevision(self)
| Return the revision id for the previous revision.
|
| DEPRECATED: Use latest_revision.parent_id instead.
|
| @rtype: int
|
| @raise AssertionError: Use on MediaWiki prior to v1.16.
|
| properties(self, force=False)
| Return the properties of the page.
|
| @param force: force updating from the live site
|
| @rtype: dict
|
| protect(self, edit=False, move=False, create=None, upload=None, unprotect=False, reason=None, prompt=None, protections=None, throttle=NotImplemented, **kwargs)
| Protect or unprotect a wiki page. Requires administrator status.
|
| Valid protection levels (in MediaWiki 1.12) are '' (equivalent to
| 'none'), 'autoconfirmed', and 'sysop'. If None is given, however,
| that protection will be skipped.
|
| @param protections: A dict mapping type of protection to protection
| level of that type.
| @type protections: dict
| @param reason: Reason for the action
| @type reason: basestring
| @param prompt: Whether to ask user for confirmation (deprecated).
| Defaults to protections is None
| @type prompt: bool
|
| protection(self)
| Return a dictionary reflecting page protections.
|
| @rtype: dict
|
| purge(self, **kwargs)
| Purge the server's cache for this page.
|
| @keyword redirects: Automatically resolve redirects.
| @type redirects: bool
| @keyword converttitles: Convert titles to other variants if necessary.
| Only works if the wiki's content language supports variant
| conversion.
| @type converttitles: bool
| @keyword forcelinkupdate: Update the links tables.
| @type forcelinkupdate: bool
| @keyword forcerecursivelinkupdate: Update the links table, and update
| the links tables for any page that uses this page as a template.
| @type forcerecursivelinkupdate: bool
| @rtype: bool
|
| put(self, newtext, summary=None, watch=None, minor=True, botflag=None, force=False, asynchronous=False, callback=None, comment='[deprecated name of summary]', watchArticle='[deprecated name of watch]', minorEdit='[deprecated name of minor]', async='[deprecated name of asynchronous]', **kwargs)
| Save the page with the contents of the first argument as the text.
|
| This method is maintained primarily for backwards-compatibility.
| For new code, using Page.save() is preferred. See save() method
| docs for all parameters not listed here.
|
| @param newtext: The complete text of the revised page.
| @type newtext: str
|
| put_async(self, newtext, summary=None, watch=None, minor=True, botflag=None, force=False, callback=None, comment='[deprecated name of summary]', watchArticle='[deprecated name of watch]', minorEdit='[deprecated name of minor]', **kwargs)
| Deprecated; use put(asynchronous=True) or save(asynchronous=True) instead.
|
|
| Put page on queue to be saved to wiki asynchronously.
|
| Asynchronous version of put (takes the same arguments), which places
| pages on a queue to be saved by a daemon thread. All arguments are
| the same as for .put(). This version is maintained solely for
| backwards-compatibility.
|
| revision_count(self, contributors=None)
| Determine number of edits from a set of contributors.
|
| @param contributors: contributor usernames
| @type contributors: iterable of str
|
| @return: number of edits for all provided usernames
| @rtype: int
|
| revisions(self, reverse=False, total=None, content=False, starttime=None, endtime=None, getText='[deprecated name of content]', reverseOrder='[deprecated name of reverse]', step=NotImplemented, rollback=NotImplemented)
| Generator which loads the version history as Revision instances.
|
| save(self, summary=None, watch=None, minor=True, botflag=None, force=False, asynchronous=False, callback=None, apply_cosmetic_changes=None, quiet=False, comment='[deprecated name of summary]', sysop=NotImplemented, async='[deprecated name of asynchronous]', **kwargs)
| Save the current contents of page's text to the wiki.
|
| @param summary: The edit summary for the modification (optional, but
| most wikis strongly encourage its use)
| @type summary: str
| @param watch: Specify how the watchlist is affected by this edit, set
| to one of "watch", "unwatch", "preferences", "nochange":
| * watch: add the page to the watchlist
| * unwatch: remove the page from the watchlist
| * preferences: use the preference settings (Default)
| * nochange: don't change the watchlist
| If None (default), follow bot account's default settings
|
| For backward compatibility watch parameter may also be boolean:
| if True, add or if False, remove this Page to/from bot
| user's watchlist.
| @type watch: str, bool (deprecated) or None
| @param minor: if True, mark this edit as minor
| @type minor: bool
| @param botflag: if True, mark this edit as made by a bot (default:
| True if user has bot status, False if not)
| @param force: if True, ignore botMayEdit() setting
| @type force: bool
| @param asynchronous: if True, launch a separate thread to save
| asynchronously
| @param callback: a callable object that will be called after the
| page put operation. This object must take two arguments: (1) a
| Page object, and (2) an exception instance, which will be None
| if the page was saved successfully. The callback is intended for
| use by bots that need to keep track of which saves were
| successful.
| @param apply_cosmetic_changes: Overwrites the cosmetic_changes
| configuration value to this value unless it's None.
| @type apply_cosmetic_changes: bool or None
| @param quiet: enable/disable successful save operation message;
| defaults to False.
| In asynchronous mode, if True, it is up to the calling bot to
| manage the output e.g. via callback.
| @type quiet: bool
|
| section(self)
| Return the name of the section this Page refers to.
|
| The section is the part of the title following a '#' character, if
| any. If no section is present, return None.
|
| @rtype: str or None
|
| templates(self, content=False, get_redirect=NotImplemented)
| Return a list of Page objects for templates used on this Page.
|
| Template parameters are ignored. This method only returns embedded
| templates, not template pages that happen to be referenced through
| a normal link.
|
| @param content: if True, retrieve the content of the current version
| of each template (default False)
| @param content: bool
|
| title(self, savetitle='[deprecated name of as_url]', withNamespace='[deprecated name of with_ns]', withSection='[deprecated name of with_section]', forceInterwiki='[deprecated name of force_interwiki]', asUrl='[deprecated name of as_url]', asLink='[deprecated name of as_link]', allowInterwiki='[deprecated name of allow_interwiki]', *, underscore=False, with_ns=True, with_section=True, as_url=False, as_link=False, allow_interwiki=True, force_interwiki=False, textlink=False, as_filename=False, insite=None, without_brackets=False)
| Return the title of this Page, as a string.
|
| @param underscore: (not used with as_link) if true, replace all ' '
| characters with '_'
| @param with_ns: if false, omit the namespace prefix. If this
| option is false and used together with as_link return a labeled
| link like [[link|label]]
| @param with_section: if false, omit the section
| @param as_url: (not used with as_link) if true, quote title as if in an
| URL
| @param as_link: if true, return the title in the form of a wikilink
| @param allow_interwiki: (only used if as_link is true) if true, format
| the link as an interwiki link if necessary
| @param force_interwiki: (only used if as_link is true) if true, always
| format the link as an interwiki link
| @param textlink: (only used if as_link is true) if true, place a ':'
| before Category: and Image: links
| @param as_filename: (not used with as_link) if true, replace any
| characters that are unsafe in filenames
| @param insite: (only used if as_link is true) a site object where the
| title is to be shown. default is the current family/lang given by
| -family and -lang option i.e. config.family and config.mylang
| @param without_brackets: (cannot be used with as_link) if true, remove
| the last pair of brackets(usually removes disambiguation brackets).
| @rtype: str
|
| toggleTalkPage(self)
| Return other member of the article-talk page pair for this Page.
|
| If self is a talk page, returns the associated content page;
| otherwise, returns the associated talk page. The returned page need
| not actually exist on the wiki.
|
| @return: Page or None if self is a special page.
| @rtype: typing.Optional[pywikibot.Page]
|
| touch(self, callback=None, botflag=False, **kwargs)
| Make a touch edit for this page.
|
| See save() method docs for all parameters.
| The following parameters will be overridden by this method:
| - summary, watch, minor, force, asynchronous
|
| Parameter botflag is False by default.
|
| minor and botflag parameters are set to False which prevents hiding
| the edit when it becomes a real edit due to a bug.
|
| @note: This discards content saved to self.text.
|
| undelete(self, reason=None, comment='[deprecated name of reason]', throttle=NotImplemented)
| Undelete revisions based on the markers set by previous calls.
|
| If no calls have been made since loadDeletedRevisions(), everything
| will be restored.
|
| Simplest case::
|
| Page(...).undelete('This will restore all revisions')
|
| More complex::
|
| pg = Page(...)
| revs = pg.loadDeletedRevisions()
| for rev in revs:
| if ... #decide whether to undelete a revision
| pg.markDeletedRevision(rev) #mark for undeletion
| pg.undelete('This will restore only selected revisions.')
|
| @param reason: Reason for the action.
| @type reason: basestring
|
| userName(self)
| Return name or IP address of last user to edit page.
|
| @rtype: str
|
| version(self)
| Return MediaWiki version number of the page site.
|
| This is needed to use @need_version() decorator for methods of
| Page objects.
|
| watch(self, unwatch=False)
| Add or remove this page to/from bot account's watchlist.
|
| @param unwatch: True to unwatch, False (default) to watch.
| @type unwatch: bool
|
| @return: True if successful, False otherwise.
| @rtype: bool
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BasePage:
|
| content_model
| Return the content model for this page.
|
| If it cannot be reliably determined via the API,
| None is returned.
|
| data_repository
| Return the Site object for the data repository.
|
| depth
| Return the depth/subpage level of the page.
|
| image_repository
| Return the Site object for the image repository.
|
| latest_revision
| Return the current revision for this page.
|
| latest_revision_id
| Return the current revision id for this page.
|
| oldest_revision
| Return the first revision of this page.
|
| @rtype: L{Revision}
|
| pageid
| Return pageid of the page.
|
| @return: pageid or 0 if page does not exist
| @rtype: int
|
| previous_revision_id
| Deprecated; use latest_revision.parent_id (0 instead of -1 when no parent) instead.
|
|
| Return the revision id for the previous revision of this Page.
|
| If the page has only one revision, it shall return -1.
|
| @rtype: int
|
| @raise AssertionError: Use on MediaWiki prior to v1.16.
|
| site
| Return the Site object for the wiki on which this Page resides.
|
| @rtype: pywikibot.Site
|
| text
| Return the current (edited) wikitext, loading it if necessary.
|
| @return: text of the page
| @rtype: str
|
| ----------------------------------------------------------------------
| Methods inherited from pywikibot.tools.ComparableMixin:
|
| __eq__(self, other)
| Compare if self is equal to other.
|
| __ge__(self, other)
| Compare if self is greater equals other.
|
| __gt__(self, other)
| Compare if self is greater than other.
|
| __le__(self, other)
| Compare if self is less equals other.
|
| __lt__(self, other)
| Compare if self is less than other.
|
| __ne__(self, other)
| Compare if self is not equal to other.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pywikibot.tools.ComparableMixin:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)