Andras Somi
03/30/2023, 10:29 AMPrivateAttr()
to create private attributes and even have a default factory to populate them, eg:
class MyResource(ConfigurableResource):
api_key: str
_session: ClientSession = PrivateAttr(default_factory=session_factory)
But what if I need one of the public attributes (eg. api_key
) from the resource object to be used in the session_factory
? This pattern won’t work, I’d need some sort of post init hook where I can set up _session
before the instantiated resource itself is passed to the assets/ops.
How should I do this?