nonza — Non-stanza stream-level XSOs (Nonzas)

This module contains XSO models for stream-level elements which are not stanzas. Since XEP-0360, these are called “nonzas”.

Changed in version 0.5: Before version 0.5, this module was called aioxmpp.stream_xsos.

General XSOs

class aioxmpp.nonza.StreamError[source]

XSO representing a stream error.

text

The text content of the stream error.

condition

The RFC 6120 stream error condition.

class aioxmpp.nonza.StreamFeatures[source]

XSO for collecting the supported stream features the remote advertises.

To register a stream feature, use register_child() with the features descriptor. A more fancy way to do the same thing is to use the as_feature_class() classmethod as decorator for your feature XSO class.

Adding new feature classes:

classmethod as_feature_class(other_cls)[source]

Querying features:

stream_features[FeatureClass]

Obtain the first feature XSO which matches the FeatureClass. If no such XSO is contained in the StreamFeatures instance stream_features, KeyError is raised.

stream_features[FeatureClass] = feature

Replace the stream features belonging to the given FeatureClass with the feature XSO.

If the FeatureClass does not match the type of the feature XSO, a TypeError is raised.

It is legal to leave the FeatureClass out by specifying ... instead. In that case, the class is auto-detected from the feature object assigned.

del stream_features[FeatureClass]

If any feature of the given FeatureClass type is in the stream_features, they are all removed.

Otherwise, KeyError is raised, to stay consistent with other mapping-like types.

get_feature(feature_cls, default=None)[source]

If a feature of the given feature_cls type is contained in the current stream features set, the first such instance is returned.

Otherwise, default is returned.

has_feature(feature_cls)[source]

Return True if the stream features contain a feature of the given feature_cls type. False is returned otherwise.