secure icon indicating copy to clipboard operation
secure copied to clipboard

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

Open EverStarck opened this issue 9 months ago • 0 comments

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

EverStarck avatar Mar 05 '25 20:03 EverStarck