Coder Social home page Coder Social logo

alejcas / flask-session-plus Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 7.0 72 KB

Flask Multiple Sessions Interface (combine multiple sessions with different backends)

License: MIT License

Python 99.19% HTML 0.81%
flask flask-extensions flask-session

flask-session-plus's People

Contributors

alejcas avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flask-session-plus's Issues

I can't create a new backend session

I'm trying to create a new backend session using redis but with other serializer. But with the information available about add new backend session i can't do it.

Shall you increase the information about this please?

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

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

Bug in total seconds

Passing datetime object to total_seconds in flask helper it should be a timedelta
self.client.set(store_id, val, self._get_memcache_timeout(total_seconds(expires)))
Generates error in redis and memcache sessions

'session_fields' : []

as document, it means "Include all", but not work.

app.config['SESSION_CONFIG'] = [
# Second session will store the user logged in inside the firestore sessions collection.
{
'cookie_name': 'SESS_ID',
'session_type': 'firestore',
'session_fields': [],
'client': firestore.Client(),
'collection': 'sessions',
},
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.