ws.client.user module

class ws.client.user.User(api)

Bases: ws.client.meta.Meta

The User class holds and interacts with information about the current user.

Valid properties are listed in the properties attribute. See the MediaWiki documentation for explanation of the properties.

All properties are evaluated lazily and cached. All cached properties are automatically invalidated after timeout seconds, except volatile_properties, which are invalidated after volatile_timeout seconds.

module = 'userinfo'
properties = {'acceptlang', 'blockinfo', 'centralids', 'changeablegroups', 'editcount', 'email', 'groupmemberships', 'groups', 'hasmsg', 'id', 'implicitgroups', 'name', 'options', 'ratelimits', 'realname', 'registrationdate', 'rights', 'unreadcount'}
volatile_properties = {'editcount', 'hasmsg', 'unreadcount'}
timeout = 3600
volatile_timeout = 300
property is_loggedin

Indicates whether the current session is authenticated (True) or not (False).

The property is evaluated lazily and cached with the @LazyProperty decorator.

set_option(option, value)

Change preferences of the current user.

See the list of available options on MediaWiki.

Parameters
  • option (str) – the option to be changed

  • value (str) – the value to be set (if empty, it will be reset to the default value)