3 from ..errors import MalformedResponse
4 from .collection import Collection
6 logger = logging.getLogger("mw.api.collections.site_info")
9 class SiteInfo(Collection):
11 General information about the site.
14 PROPERTIES = {'general', 'namespaces', 'namespacealiases',
15 'specialpagealiases', 'magicwords', 'interwikimap',
16 'dbrepllag', 'statistics', 'usergroups', 'extensions',
17 'fileextensions', 'rightsinfo', 'languages', 'skins',
18 'extensiontags', 'functionhooks', 'showhooks',
19 'variables', 'protocols'}
21 FILTERIW = {'local', '!local'}
23 def query(self, properties=None, filteriw=None, showalldb=None,
24 numberinggroup=None, inlanguagecode=None):
26 General information about the site.
27 See `<https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si>`_
31 Which sysinfo properties to get:
33 * general - Overall system information
34 * namespaces - List of registered namespaces and their canonical names
35 * namespacealiases - List of registered namespace aliases
36 * specialpagealiases - List of special page aliases
37 * magicwords - List of magic words and their aliases
38 * statistics - Returns site statistics
39 * interwikimap - Returns interwiki map (optionally filtered, (optionally localised by using siinlanguagecode))
40 * dbrepllag - Returns database server with the highest replication lag
41 * usergroups - Returns user groups and the associated permissions
42 * extensions - Returns extensions installed on the wiki
43 * fileextensions - Returns list of file extensions allowed to be uploaded
44 * rightsinfo - Returns wiki rights (license) information if available
45 * restrictions - Returns information on available restriction (protection) types
46 * languages - Returns a list of languages MediaWiki supports(optionally localised by using siinlanguagecode)
47 * skins - Returns a list of all enabled skins
48 * extensiontags - Returns a list of parser extension tags
49 * functionhooks - Returns a list of parser function hooks
50 * showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)
51 * variables - Returns a list of variable IDs
52 * protocols - Returns a list of protocols that are allowed in external links.
53 * defaultoptions - Returns the default values for user preferences.
55 "local" or "!local" Return only local or only nonlocal entries of the interwiki map
57 List all database servers, not just the one lagging the most
59 Lists the number of users in user groups
61 Language code for localised language names (best effort, use CLDR extension)
64 siprop = self._items(properties, levels=self.PROPERTIES)
66 doc = self.session.get(
71 'sifilteriw': filteriw,
72 'sishowalldb': showalldb,
73 'sinumberinggroup': numberinggroup,
74 'siinlanguagecode': inlanguagecode
81 raise MalformedResponse(str(e), doc)