aiocoap.util.linkformat module¶
This module contains in-place modifications to the LinkHeader module to satisfy RFC6690 constraints.
It is a general nursery for what aiocoap needs of link-format management before any of this is split out into its own package.
- class aiocoap.util.linkformat.LinkFormat(links=None)¶
Bases:
LinkHeaderVariation of the now vendered-in link_header package.
This accounts for the RFC6690 constraint (not present in RFC5899) that there be no space after commas or semicolons.
>>> str(LinkFormat([Link("/parent/", rel="up"), Link("/parent/here/child")])) '</parent/>;rel="up",</parent/here/child>'
- aiocoap.util.linkformat.parse(linkformat: str | bytes) LinkFormat¶
Parses RFC6690 links.
Unlike the (now vendored-in) link_header package’s parsing, this
accepts either bytes or strings; the former are decoded as UTF-8
produces types that, in their serialization, account for differences between RFC6690 and RFC5899
>>> parse(b"</hell\xc3\xb6>") LinkHeader([Link('/hellö')]) >>> parse("</hellö>") LinkHeader([Link('/hellö')])