Soup.HSTSPolicy¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
domain |
r/w |
The domain or hostname that the policy applies to |
|
expires |
r/w |
the policy expiration time, or |
|
include_subdomains |
r/w |
|
|
max_age |
r/w |
The maximum age, in seconds, that the policy is valid |
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Soup.HSTSPolicy¶
An HTTP Strict Transport Security policy.
domain represents the host that this policy applies to. The domain must be IDNA-canonicalized.
Soup.HSTSPolicy.new
() and related methods will do this for you.max_age contains the ‘max-age’ value from the Strict Transport Security header and indicates the time to live of this policy, in seconds.
expires will be non-
None
if the policy has been set by the host and hence has an expiry time. If expires isNone
, it indicates that the policy is a permanent session policy set by the user agent.If include_subdomains is
True
, the Strict Transport Security policy must also be enforced on subdomains of domain.New in version 2.68.
- classmethod new(domain, max_age, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Creates a new
Soup.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; pass
Soup.HSTS_POLICY_MAX_AGE_PAST
for an already-expired policy, or a lifetime in seconds.If include_subdomains is
True
, the strict transport security policy must also be enforced on all subdomains of domain.New in version 2.68.
- classmethod new_from_response(msg)¶
- Parameters:
msg (
Soup.Message
) – aSoup.Message
- Returns:
a new
Soup.HSTSPolicy
, orNone
if no valid “Strict-Transport-Security” response header was found.- Return type:
Parses msg's first “Strict-Transport-Security” response header and returns a
Soup.HSTSPolicy
.New in version 2.68.
- classmethod new_full(domain, max_age, expires, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Full version of
Soup.HSTSPolicy.new
(), to use with an existing expiration date. SeeSoup.HSTSPolicy.new
() for details.New in version 2.68.
- classmethod new_session_policy(domain, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Creates a new session
Soup.HSTSPolicy
with the given attributes. A session policy is a policy that is valid during the lifetime of theSoup.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 is
True
, the strict transport security policy must also be enforced on all subdomains of domain.New in version 2.68.
- copy()¶
- Returns:
a copy of self
- Return type:
Copies self.
New in version 2.68.
- equal(policy2)¶
- Parameters:
policy2 (
Soup.HSTSPolicy
) – aSoup.HSTSPolicy
- Returns:
whether the policies are equal.
- Return type:
Tests if self and policy2 are equal.
New in version 2.68.
- free()¶
Frees self.
New in version 2.68.
- includes_subdomains()¶
-
Gets whether self include its subdomains.
New in version 2.68.
- is_expired()¶
-
Gets whether self is expired. Permanent policies never expire.
New in version 2.68.
- is_session_policy()¶
-
Gets whether self is a non-permanent, non-expirable session policy. see
Soup.HSTSPolicy.new_session_policy
() for details.New in version 2.68.