FinTS Segment Sequence¶
A message is a sequence of segments. The SegmentSequence
object allows searching for segments by type and version, by default recursing into nested sequences.
- class fints.types.SegmentSequence(segments=None)[source]¶
A sequence of FinTS3Segment objects
- find_segment_first(*args, **kwargs)[source]¶
Finds the first matching segment.
Same parameters as find_segments(), but only returns the first match, or None if no match is found.
- find_segment_highest_version(query=None, version=None, callback=None, recurse=True, default=None)[source]¶
Finds the highest matching segment.
Same parameters as find_segments(), but returns the match with the highest version, or default if no match is found.
- find_segments(query=None, version=None, callback=None, recurse=True, throw=False)[source]¶
Yields an iterable of all matching segments.
- Parameters:
query – Either a str or class specifying a segment type (such as ‘HNHBK’, or
HNHBK3
), or a list or tuple of strings or classes. If a list/tuple is specified, segments returning any matching type will be returned.version – Either an int specifying a segment version, or a list or tuple of ints. If a list/tuple is specified, segments returning any matching version will be returned.
callback – A callable that will be given the segment as its sole argument and must return a boolean indicating whether to return this segment.
recurse – If True (the default), recurse into SegmentSequenceField values, otherwise only look at segments in this SegmentSequence.
throw – If True, a FinTSNoResponseError is thrown if no result is found. Defaults to False.
The match results of all given parameters will be AND-combined.