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: Optional[str]#

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 ServerError if the response indicates a server error.

New in version 3.0.

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