alejcas / flask-session-plus

Flask Multiple Sessions Interface (combine multiple sessions with different backends)
MIT License
14 stars 7 forks source link

SecureCookieSessionInterface: cannot import name 'total_seconds' from 'flask.helpers' #13

Open MarcoBorrini99 opened 2 years ago

MarcoBorrini99 commented 2 years ago

I'm actually trying to use the extension in a multi-session environment.

With the following configuration:

import redis
SESSION_CONFIG = [
        # First session will store the password value on it's own cookie.
        {
            'cookie_name': 'fsp',
            'session_type': 'secure_cookie',
            'session_fields': ['password'],
        },
        # Second session will store any other values set on the Flask session on it's own secure cookie
        {
            'cookie_name': 'session',
            'session_type': 'redis',
            'session_fields': 'auto',
            'client': redis.Redis(host='portainer-dc_redis-dc_1', port=6379, db=0)
        }
    ]

my flask app doesn't start with the following log:

/home/marco/PycharmProjects/corkscrew/venv/bin/python /home/marco/PycharmProjects/corkscrew/wsgi.py 
Traceback (most recent call last):
  File "/home/marco/PycharmProjects/corkscrew/wsgi.py", line 2, in <module>
    from app import app
  File "/home/marco/PycharmProjects/corkscrew/app/__init__.py", line 13, in <module>
    from flask_session_plus import Session
  File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/__init__.py", line 1, in <module>
    from flask_session_plus.session import Session
  File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/session.py", line 2, in <module>
    from flask_session_plus.backends import SecureCookieSessionInterface, FirestoreSessionInterface
  File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/backends.py", line 8, in <module>
    from flask.helpers import total_seconds
ImportError: cannot import name 'total_seconds' from 'flask.helpers' (/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask/helpers.py)

Process finished with exit code 1

Just before going mad, is flask-session-plus Flask==2.1.3 compatible?

Regards

alejcas commented 2 years ago

I don’t think it’s compatible