def _parse_config()

in bonsaicli2/bonsai_cli/cookies.py [0:0]


    def _parse_config(self) -> None:
        for section in _COOKIE_SECTIONS:
            if not self._config_parser.has_section(section):
                self._config_parser.add_section(section)
            else:
                # If this is the session section, cast the values into a SessionId object
                for _, value in self._config_parser.items(section):
                    if section == _SESSION_ID_SECION:
                        session_id_str, expiry_str = value.split(_SESSION_ID_SPLIT_CHAR)
                        session_id: UUID = UUID(session_id_str)
                        expiry: datetime = datetime.strptime(
                            expiry_str, "%Y-%m-%d %H:%M:%S.%f"
                        )
                        self.session_id = SessionId(session_id, expiry)
                    elif section == _USERID_SECTION:
                        self.user_id = UUID(value)

        self._write_config_to_file()