{ } Raw JSON

bundles / jupyter_client latest / jupyter_client / session / Session / serialize

function

jupyter_client.session:Session.serialize

source: /jupyter_client/session.py:696

Signature

def serialize(self, msg: dict[str, t.Any], ident: list[bytes] | bytes | None = None) → list[bytes]

Summary

Serialize the message components to bytes.

Extended Summary

This is roughly the inverse of deserialize. The serialize/deserialize methods work with full message lists, whereas pack/unpack work with the individual message parts in the message list.

Parameters

msg : dict or Message

The next message dict as returned by the self.msg method.

Returns

msg_list : list

The list of bytes objects to be sent with the format

[ident1, ident2, ..., DELIM, HMAC, p_header, p_parent,
 p_metadata, p_content, buffer1, buffer2, ...]

In this list, the p_* entities are the packed or serialized versions, so if JSON is used, these are utf8 encoded JSON strings.

Aliases

  • jupyter_client.channels.Session.serialize