HSTSPolicy
- class HSTSPolicy(**kwargs)
- Constructors:
new(domain:str, max_age:int, include_subdomains:bool) -> Soup.HSTSPolicy
new_from_response(msg:Soup.Message) -> Soup.HSTSPolicy or None
new_full(domain:str, max_age:int, expires:GLib.DateTime, include_subdomains:bool) -> Soup.HSTSPolicy
new_session_policy(domain:str, include_subdomains:bool) -> Soup.HSTSPolicy
Constructors
- class HSTSPolicy
- classmethod new(domain: str, max_age: int, include_subdomains: bool) HSTSPolicy
Creates a new
HSTSPolicy
with the given attributes.domain
is a domain on which the strict transport security policy represented by this object must be enforced.max_age
is used to set the “expires” attribute on the policy; passHSTS_POLICY_MAX_AGE_PAST
for an already-expired policy, or a lifetime in seconds.If
include_subdomains
isTrue
, the strict transport security policy must also be enforced on all subdomains ofdomain
.- Parameters:
domain – policy domain or hostname
max_age – max age of the policy
include_subdomains –
True
if the policy applies on subdomains
- classmethod new_from_response(msg: Message) HSTSPolicy | None
Parses
msg
’s first “Strict-Transport-Security” response header and returns aHSTSPolicy
.- Parameters:
msg – a
Message
- classmethod new_full(domain: str, max_age: int, expires: DateTime, include_subdomains: bool) HSTSPolicy
Full version of
new
, to use with an existing expiration date.See
new
for details.- Parameters:
domain – policy domain or hostname
max_age – max age of the policy
expires – the date of expiration of the policy or
None
for a permanent policyinclude_subdomains –
True
if the policy applies on subdomains
- classmethod new_session_policy(domain: str, include_subdomains: bool) HSTSPolicy
Creates a new session
HSTSPolicy
with the given attributes.A session policy is a policy that is valid during the lifetime of the
HSTSEnforcer
it is added to. Contrary to regular policies, it has no expiration date and is not stored in persistent enforcers. These policies are useful for user-agent to load their own or user-defined rules.domain
is a domain on which the strict transport security policy represented by this object must be enforced.If
include_subdomains
isTrue
, the strict transport security policy must also be enforced on all subdomains ofdomain
.- Parameters:
domain – policy domain or hostname
include_subdomains –
True
if the policy applies on sub domains
Methods
- class HSTSPolicy
- equal(policy2: HSTSPolicy) bool
Tests if
policy1
andpolicy2
are equal.- Parameters:
policy2 – a
HSTSPolicy