site_detect — Classes for Detecting MediaWiki Sites#

Classes for detecting a MediaWiki site.

class site_detect.MWSite(fromurl, **kwargs)[source]#

Bases: object

Minimal wiki site class.

Raises:
  • pywikibot.exceptions.ServerError – a server error occurred while loading the site

  • Timeout – a timeout occurred while loading the site

  • RuntimeError – Version not found or version less than 1.27

property api: str | None#

Get api URL.

property iwpath#

Get article path URL.

property langs#

Build interwikimap.

class site_detect.WikiHTMLPageParser(url)[source]#

Bases: HTMLParser

Wiki HTML page parser.

handle_starttag(tag, attrs)[source]#

Handle an opening tag.

Return type:

None

set_api_url(url)[source]#

Set api_url.

Return type:

None

set_version(value)[source]#

Set highest version.

Return type:

None

site_detect.check_response(response)[source]#

Raise ClientError or ServerError depending on http status.

Added in version 3.0.

Changed in version 7.0: Raise a generic exceptions.ServerError if http status code is not IANA-registered but unofficial code

Changed in version 8.1: Raise a exceptions.ClientError if status code is 4XX