flask_cookie_decode package¶
Submodules¶
flask_cookie_decode.cookie_decode module¶
- class flask_cookie_decode.cookie_decode.CookieDecode(app=None)[source]¶
Bases:
object
This class is used to inspect the signed-cookie session that Flask ships with. Initializing this class follows the usual procedure:
app = Flask(__name__) cookie = CookieDecode(app)
Or if you wish to create the object once and configure the application later to support it:
cookie = CookieDecode() def create_app(): app = Flask(__name__) cookie.init_app(app) return app
Once the application has been initialized with the extension, a new command will be available via the Flask CLI:
flask cookie decode <cookie-here>
This command takes one argument, the Flask session cookie. The session cookie can be retrieved from a browser.
Reference: https://blog.miguelgrinberg.com/post/how-secure-is-the-flask-user-session
- decode_cookie(cookie)[source]¶
Decode a cookie by first checking the signature of the cookie. If the signature is valid, the cookie will be loaded and marked as “safe”. If the signature is invalid, the cookie will be loaded but it will be marked as “unsafe”.
“Unsafe” here means that content of the cookie has not been signed by the correct secret key. That or the signature of the cookie itself is malformed or tampered with.
- class flask_cookie_decode.cookie_decode.ExpiredCookie(contents, expiration)¶
Bases:
tuple
- contents¶
Alias for field number 0
- expiration¶
Alias for field number 1
Module contents¶
flaskext.flask-cookie-decode¶
Tools for debugging and working with the built-in Flask session cookie
- copyright:
by Kyle Lawlor.
- license:
MIT license , see LICENSE for more details.