Skip to content

context

messageflux.utils.context

Context

a stack like context object. allows to store some key-value data and access it

get abstractmethod

get(key, default=None)

gets the current value for 'key' in the context. returns default if key does not exist

Parameters:

Name Type Description Default
key str

the key to get

required
default

the default value to return if key does not exist

None

Returns:

Type Description
Any

the current value for 'key' in the context. returns 'default' if key does not exist

get_current_context abstractmethod

get_current_context()

gets the complete current context

start_context abstractmethod

start_context(**kwargs)

starts the context manager

Parameters:

Name Type Description Default
**kwargs

kwargs to push to the context

{}