# `shim` — Stanza Headers and Internet Metadata (XEP-0131)

This module provides support for XEP-0131 stanza headers. The following attributes are added by this module to the existing stanza classes:

aioxmpp.Message.xep0131_headers

  A `xso.Headers` instance or `None`. Represents the SHIM headers of the stanza.

aioxmpp.Presence.xep0131_headers

  A `xso.Headers` instance or `None`. Represents the SHIM headers of the stanza.

The attributes are available as soon as `aioxmpp.shim` is loaded.

class aioxmpp.SHIMService(client, **kwargs)

  This service implements XEP-0131 feature advertisement.

  It registers the `http://jabber.org/protocol/shim` node with the `DiscoServer`. It publishes the supported headers on that node as specified in the XEP.

  To announce supported headers, use the `register_header()` and `unregister_header()` methods.

  register_header(name)

    Register support for the SHIM header with the given name.

    If the header has already been registered as supported, `ValueError` is raised.

  unregister_header(name)

    Unregister support for the SHIM header with the given name.

    If the header is currently not registered as supported, `KeyError` is raised.

  Changed in version 0.8: This class was formerly known as `aioxmpp.shim.Service`. It is still available under that name, but the alias will be removed in 1.0.

class aioxmpp.shim.Service

  Alias of `SHIMService`.

  Deprecated since version 0.8: The alias will be removed in 1.0.

class aioxmpp.shim.xso.Headers(*args, **kwargs)

  Represent stanza headers. The headers are accessible at the `headers` attribute.

  headers

    A `multidict.CIMultiDict` which provides access to the headers. The keys are the header names and the values are the values of the header. Both must be strings.

  See also

  `Message.xep0131_headers`

    SHIM headers for `Message` stanzas

  `Presence.xep0131_headers`

    SHIM headers for `Presence` stanzas