Skip to content
Back to top
View this page

# XEP-0511: Link Metadata

XEP-0511 on xmpp.org

class slixmpp.plugins.xep_0511.XEP_0511(xmpp, config=None)

  This plugin add supports for XEP-0511: Link Metadata.

  It does not register any stream handler, it just registers stanza interfaces.

  stanza = <module 'slixmpp.plugins.xep_0511.stanza' from '/build/slixmpp-QRhfpR/slixmpp-1.17.0/slixmpp/plugins/xep_0511/stanza.py'>

## Stanza elements

Stanza interfaces for XEP-0511: Link Metadata

Usage:

    >>> register_plugin()  # automatically done if you use this plugin
    >>> msg = Message()
    >>> msg["link_metadata"]["about"] = "https://the.link.example.com/what-was-linked-to"
    >>> msg["link_metadata"]["title"] = "A cool title"
    >>> msg.pretty_print()
    <message xmlns="jabber:client">
      <Description xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://the.link.example.com/what-was-linked-to">
        <title xmlns="https://ogp.me/ns#">A cool title</title>
      </Description>
    </message>

class slixmpp.plugins.xep_0511.stanza.Description(xml=None, parent=None)
  name: ClassVar[str] = 'description'

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

  plugin_attrib: ClassVar[str] = 'description'

    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_0511.stanza.Image(xml=None, parent=None)
  name: ClassVar[str] = 'image'

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

  plugin_attrib: ClassVar[str] = 'image'

    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_0511.stanza.LinkMetadata(xml=None, parent=None)
  get_about()
    Return type:

      `str` | `None`

  get_description()
    Return type:

      `str` | `None`

  get_image()
    Return type:

      `str` | `None`

  get_site_name()
    Return type:

      `str` | `None`

  get_title()
    Return type:

      `str` | `None`

  get_type()
    Return type:

      `str` | `None`

  get_url()
    Return type:

      `str` | `None`

  interfaces: ClassVar[set[str]] = {'about', 'description', 'image', 'site_name', 'title', 'type', 'url'}

    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] = 'Description'

    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 = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'

    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] = 'link_metadata'

    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']

  plugin_multi_attrib: ClassVar[str] = 'link_metadatas'

    For `ElementBase` subclasses that are intended to be an iterable group of items, the `plugin_multi_attrib` value defines an interface for the parent stanza which returns the entire group of matching substanzas. So the following are equivalent:

        # Given stanza class Foo, with plugin_multi_attrib = 'foos'
        parent['foos']
        filter(isinstance(item, Foo), parent['substanzas'])

  set_about(about)
    Return type:

      `None`

  set_description(v)
    Return type:

      `None`

  set_image(v)
    Return type:

      `None`

  set_site_name(v)
    Return type:

      `None`

  set_title(v)
    Return type:

      `None`

  set_type(v)
    Return type:

      `None`

  set_url(v)
    Return type:

      `None`

class slixmpp.plugins.xep_0511.stanza.SiteName(xml=None, parent=None)
  name: ClassVar[str] = 'site_name'

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

  plugin_attrib: ClassVar[str] = 'site_name'

    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_0511.stanza.Title(xml=None, parent=None)
  name: ClassVar[str] = 'title'

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

  plugin_attrib: ClassVar[str] = 'title'

    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_0511.stanza.Type_(xml=None, parent=None)
  name: ClassVar[str] = 'type'

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

  plugin_attrib: ClassVar[str] = 'type'

    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_0511.stanza.Url(xml=None, parent=None)
  name: ClassVar[str] = 'url'

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

  plugin_attrib: ClassVar[str] = 'url'

    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']

slixmpp.plugins.xep_0511.stanza.register_plugin()
  Return type:

    `None`