bundles / jupyter_client latest / jupyter_client / session / Session
MetaHasTraits
jupyter_client.session:Session
source: /jupyter_client/session.py:337
Signature
def Session(**kwargs: t.Any) → NoneMembers
Summary
Object for handling serialization and sending of messages.
Extended Summary
The Session object handles building messages and sending them with ZMQ sockets or ZMQStream objects. Objects can communicate with each other over the network via Session objects, and only need to work with the dict-based IPython message spec. The Session will handle serialization/deserialization, security, and metadata.
Sessions support configurable serialization via packer/unpacker traits, and signing with HMAC digests via the key/keyfile traits.
Parameters
debug: boolwhether to trigger extra debugging statements
packer/unpacker: str : 'orjson', 'json', 'pickle', 'msgpack' or import_stringimportstrings for methods to serialize message parts. If just 'json' or 'pickle', predefined JSON and pickle packers will be used. Otherwise, the entire importstring must be used.
The functions must accept at least valid JSON input, and output bytes.
For example, to use msgpack: packer = 'msgpack.packb', unpacker='msgpack.unpackb'
pack/unpack: callablesYou can also set the pack/unpack callables for serialization directly.
session: bytesthe ID of this Session object. The default is to generate a new UUID.
username: unicodeusername added to message headers. The default is to ask the OS.
key: bytesThe key used to initialize an HMAC signature. If unset, messages will not be signed or checked.
keyfile: filepathThe file containing a key. If this is set, key will be initialized to the contents of the file.
Aliases
jupyter_client.channels.Session