def __init__(self, session: Session, configuration: Configuration, existing: Optional[Headers] = None) -> None: assert isinstance(session, Session) self._debug = configuration.debug self._configuration = configuration self._session = session headers = Headers() if existing is not None: assert isinstance(existing, Headers) headers = existing headers.add('Set-Cookie', self._generate_session_cookie(self._debug)) headers.add('Set-Cookie', self._generate_key_cookie(self._debug)) headers.add( 'Set-Cookie', self.generate_flag_cookie(logged_in=True, debug=configuration.debug, configuration=configuration)) self._raw = headers.dictionary super().__init__(headers) return
def flag_signout(cls: Type[T], debug: bool, configuration: Configuration, existing_headers: Optional[Headers] = None) -> Headers: existing = existing_headers headers = Headers() if existing is not None: assert isinstance(existing, Headers) headers = existing headers.add( 'Set-Cookie', cls.generate_flag_cookie(logged_in=False, debug=debug, configuration=configuration)) return headers
def simulate_cookie_headers(self, debug: bool = True) -> Headers: headers = Headers() headers.add('Cookie', self.simulate_cookie(debug)) return headers