Skip to content

AttributeError: 'Secure' object has no attribute 'hsts' #32

@EverStarck

Description

@EverStarck

I'm following the doc for customization but I get an error:

  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/app/main.py", line 33, in <module>
    secure_headers.hsts.max_age(63072000)  # Override the default max-age value
AttributeError: 'Secure' object has no attribute 'hsts'

Code:

from secure import Secure, Preset

secure_headers = Secure.from_preset(Preset.BASIC)
secure_headers.hsts.max_age(63072000)  # Override the default max-age value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions