:right-sidebar: True HSTSEnforcer =================================================================== .. currentmodule:: gi.repository.Soup .. class:: HSTSEnforcer(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Soup.HSTSEnforcerDB` Implemented Interfaces: :class:`~gi.repository.Soup.SessionFeature` :Constructors: :: HSTSEnforcer(**properties) new() -> Soup.HSTSEnforcer Constructors ------------ .. rst-class:: interim-class .. class:: HSTSEnforcer :no-index: .. classmethod:: new() -> ~gi.repository.Soup.HSTSEnforcer Creates a new :obj:`~gi.repository.Soup.HSTSEnforcer`. The base :obj:`~gi.repository.Soup.HSTSEnforcer` class does not support persistent storage of HSTS policies, see :obj:`~gi.repository.Soup.HSTSEnforcerDB` for that. Methods ------- .. rst-class:: interim-class .. class:: HSTSEnforcer :no-index: .. method:: get_domains(session_policies: bool) -> list[str] Gets a list of domains for which there are policies in ``enforcer``. :param session_policies: whether to include session policies .. method:: get_policies(session_policies: bool) -> list[~gi.repository.Soup.HSTSPolicy] Gets a list with the policies in ``enforcer``. :param session_policies: whether to include session policies .. method:: has_valid_policy(domain: str) -> bool Gets whether ``hsts_enforcer`` has a currently valid policy for ``domain``. :param domain: a domain. .. method:: is_persistent() -> bool Gets whether ``hsts_enforcer`` stores policies persistenly. .. method:: set_policy(policy: ~gi.repository.Soup.HSTSPolicy) -> None Sets ``policy`` to ``hsts_enforcer``. If ``policy`` is expired, any existing HSTS policy for its host will be removed instead. If a policy existed for this host, it will be replaced. Otherwise, the new policy will be inserted. If the policy is a session policy, that is, one created with :obj:`~gi.repository.HSTSPolicy.new_session_policy`, the policy will not expire and will be enforced during the lifetime of ``hsts_enforcer``'s :obj:`~gi.repository.Soup.Session`. :param policy: the policy of the HSTS host .. method:: set_session_policy(domain: str, include_subdomains: bool) -> None Sets a session policy for ``domain``. A session policy is a policy that is permanent to the lifetime of ``hsts_enforcer``'s :obj:`~gi.repository.Soup.Session` and doesn't expire. :param domain: policy domain or hostname :param include_subdomains: :const:`True` if the policy applies on sub domains Signals ------- .. rst-class:: interim-class .. class:: HSTSEnforcer.signals :no-index: .. method:: changed(old_policy: ~gi.repository.Soup.HSTSPolicy, new_policy: ~gi.repository.Soup.HSTSPolicy) -> None Emitted when ``hsts_enforcer`` changes. If a policy has been added, ``new_policy`` will contain the newly-added policy and ``old_policy`` will be :const:`None`. If a policy has been deleted, ``old_policy`` will contain the to-be-deleted policy and ``new_policy`` will be :const:`None`. If a policy has been changed, ``old_policy`` will contain its old value, and ``new_policy`` its new value. Note that you shouldn't modify the policies from a callback to this signal. :param old_policy: the old :obj:`~gi.repository.Soup.HSTSPolicy` value :param new_policy: the new :obj:`~gi.repository.Soup.HSTSPolicy` value Virtual Methods --------------- .. rst-class:: interim-class .. class:: HSTSEnforcer :no-index: .. method:: do_changed(old_policy: ~gi.repository.Soup.HSTSPolicy, new_policy: ~gi.repository.Soup.HSTSPolicy) -> None :param old_policy: :param new_policy: .. method:: do_has_valid_policy(domain: str) -> bool Gets whether ``hsts_enforcer`` has a currently valid policy for ``domain``. :param domain: a domain. .. method:: do_is_persistent() -> bool Gets whether ``hsts_enforcer`` stores policies persistenly. Fields ------ .. rst-class:: interim-class .. class:: HSTSEnforcer :no-index: .. attribute:: parent_instance