...instead of werkzeug.security.safe_str_cmp, which is deprecated as of Werkzeug 2.0 and emits a DeprecationWarning on usage:
flask_seasurf.py:317: DeprecationWarning: 'safe_str_cmp' is deprecated and will be removed in Werkzeug 2.1. Use 'hmac.compare_digest' instead.
if some_none or not safe_str_cmp(request_csrf_token, server_csrf_token):
Note that hmac.compare_digest is available in Python 2.7.7+ and Python 3.3+. In order not to make things worse for older Python versions, we fall back to the old behaviour if it is unavailable.
...instead of
werkzeug.security.safe_str_cmp
, which is deprecated as of Werkzeug 2.0 and emits a DeprecationWarning on usage:Note that
hmac.compare_digest
is available in Python 2.7.7+ and Python 3.3+. In order not to make things worse for older Python versions, we fall back to the old behaviour if it is unavailable.