XEP-0494: Client Access Management

class slixmpp.plugins.xep_0494.XEP_0494(xmpp, config=None)[source]

XEP-0494: Client Access Management

async get_clients(*, timeout=None, **iqargs)[source]

Return a list of clients that have accessed the account.

Raises:
  • IqTimeout – If the request times out.

  • IqError – If the server answers with an error.

Return type:

list[Client]

async revoke(client_id, *, timeout=None, **iqargs)[source]

Revoke a specific client access by id. Revoking clients that have password access requires to change the password and will raise an error.

Parameters:

client_id (str) – id of the client to revoke.

Raises:
  • IqTimeout – If the request times out.

  • IqError – If the server answers with an error.

Return type:

Iq

Stanza elements

class slixmpp.plugins.xep_0494.stanza.Auth(xml=None, parent=None)[source]

Auth element.

<auth>
    <fast/>
    <custom-element xmlns="urn:custom"/>
</auth>
bool_interfaces: ClassVar[set[str]] = {'fast', 'password'}

A subset of interfaces which maps the presence of subelements to boolean values. Using this set allows for quickly checking for the existence of empty subelements like <required />.

Added in version 1.1.

get_auths()[source]
Return type:

dict

interfaces: ClassVar[set[str]] = {'all', 'fast', 'password'}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'auth'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

overrides: ClassVar[list[str]] = {'get_auths'}

In some cases you may wish to override the behaviour of one of the parent stanza’s interfaces. The overrides list specifies the interface name and access method to be overridden. For example, to override setting the parent’s 'condition' interface you would use:

overrides = ['set_condition']

Getting and deleting the 'condition' interface would not be affected.

Added in version 1.0-Beta5.

plugin_attrib: ClassVar[str] = 'auth'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
class slixmpp.plugins.xep_0494.stanza.Client(xml=None, parent=None)[source]

Client element.

<client xmlns="urn:xmpp:cam:0" type="session" id="a" connected="true">
    </client>

Many of the substanzas defined are using overrides to access and set data from this element, e.g.:

client = Client()
client['user_agent'] = {'software': 'slixmpp', 'device': 'toto'}

will actually create

<client xmlns="urn:xmpp:cam:0">
    <user-agent>
        <software>slixmpp</software>
        <device>toto</device>
    </user-agent>
</client>
del_permission()[source]
Return type:

None

del_user_agent()[source]
Return type:

None

get_connected()[source]
Return type:

bool | None

get_first_seen()[source]
Return type:

datetime | None

get_last_seen()[source]
Return type:

datetime | None

get_type()[source]
Return type:

ClientType | None

interfaces: ClassVar[set[str]] = {'connected', 'first_seen', 'id', 'last_seen', 'permission', 'permission_extra', 'type'}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'client'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'client'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
set_connected(connected)[source]
Return type:

None

set_first_seen(time)[source]
Return type:

None

set_last_seen(time)[source]
Return type:

None

set_type(type_)[source]
Return type:

None

class slixmpp.plugins.xep_0494.stanza.ClientType(value)[source]

Enum representing the type attribute of the <client/> element.

ACCESS = 'access'
SESSION = 'session'
class slixmpp.plugins.xep_0494.stanza.Clients(xml=None, parent=None)[source]

List of clients.

Iterate on it to get all substanzas.

<clients xmlns="urn:xmpp:cam:0">
    …
</clients>
name: ClassVar[str] = 'clients'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'clients'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
class slixmpp.plugins.xep_0494.stanza.Grant(xml=None, parent=None)[source]

<grant/> element.

name: ClassVar[str] = 'grant'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'grant'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
class slixmpp.plugins.xep_0494.stanza.List(xml=None, parent=None)[source]

Element used to request a list of devices to the server.

interfaces: ClassVar[set[str]] = {}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'list'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'list'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
class slixmpp.plugins.xep_0494.stanza.Permission(xml=None, parent=None)[source]

Permission element.

del_permission_extra()[source]
Return type:

None

get_permission()[source]
Return type:

PermissionEnum | None

get_permission_extra()[source]
Return type:

list[ElementBase]

interfaces: ClassVar[set[str]] = {'permission', 'permission_extra'}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'permission'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

overrides: ClassVar[list[str]] = {'del_permission_extra', 'get_permission', 'get_permission_extra', 'set_permission', 'set_permission_extra'}

In some cases you may wish to override the behaviour of one of the parent stanza’s interfaces. The overrides list specifies the interface name and access method to be overridden. For example, to override setting the parent’s 'condition' interface you would use:

overrides = ['set_condition']

Getting and deleting the 'condition' interface would not be affected.

Added in version 1.0-Beta5.

plugin_attrib: ClassVar[str] = 'permission'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
set_permission(permission)[source]
Return type:

None

set_permission_extra(extras)[source]
Return type:

None

class slixmpp.plugins.xep_0494.stanza.PermissionEnum(value)[source]

Enum representing the status of the <permission/> element, e.g:

<permission status="normal/>
NORMAL = 'normal'
RESTRICTED = 'restricted'
UNRESTRICTED = 'unrestricted'
class slixmpp.plugins.xep_0494.stanza.Revoke(xml=None, parent=None)[source]

Element used to revoke a device.

interfaces: ClassVar[set[str]] = {'id'}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'revoke'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'revoke'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
class slixmpp.plugins.xep_0494.stanza.UserAgent(xml=None, parent=None)[source]
as_dict()[source]
Return type:

dict[str, str]

interfaces: ClassVar[set[str]] = {'device', 'software', 'uri'}

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

name: ClassVar[str] = 'user-agent'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'urn:xmpp:cam:0'

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

plugin_attrib: ClassVar[str] = 'user_agent'

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()
msg['foo']['an_interface_from_the_foo_plugin']
sub_interfaces: ClassVar[set[str]] = {'device', 'software', 'uri'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

slixmpp.plugins.xep_0494.stanza.register_plugins()[source]
Return type:

None