httk.serve.http.identifiers¶
Wire-format identifier and timestamp primitives shared across serving protocols.
These helpers carry no protocol vocabulary: they normalise a UUID factory
result to the urn:uuid: URN form, render a timezone-aware datetime as an
XSD/RFC 3339 UTC timestamp, and report whether a string is free of lone UTF-16
surrogate code points. Protocol packages such as httk.serve.dsp consume
them for on-the-wire message construction.
Functions¶
|
Report whether a string is free of lone UTF-16 surrogate code points. |
|
Normalise a UUID factory result to the required |
|
Render a timezone-aware datetime as an XSD/RFC 3339 UTC timestamp. |
Module Contents¶
- httk.serve.http.identifiers.is_json_encodable_text(value)[source]¶
Report whether a string is free of lone UTF-16 surrogate code points.
- httk.serve.http.identifiers.urn_uuid(value)[source]¶
Normalise a UUID factory result to the required
urn:uuid:URN form.- Parameters:
value (object) – UUID factory output rendered to text before normalisation.
- Returns:
The identifier in
urn:uuid:form.- Raises:
RuntimeError – If the rendered value is blank or contains a lone surrogate.
- Return type:
- httk.serve.http.identifiers.xsd_utc_timestamp(value)[source]¶
Render a timezone-aware datetime as an XSD/RFC 3339 UTC timestamp.
- Parameters:
value (datetime.datetime) – Timezone-aware datetime to render as a UTC XML Schema date-time.
- Returns:
The value in UTC with a
Zsuffix.- Raises:
ValueError – If
valueis naive or lacks a UTC offset.
- Return type: