Navigation

  • index
  • modules |
  • flask-cookie-decode 0.4.3 documentation »
  • flask_cookie_decode package

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.

init_app(app)[source]¶

Initalizes the application with the extension.

class flask_cookie_decode.cookie_decode.ExpiredCookie(contents, expiration)¶

Bases: tuple

contents¶

Alias for field number 0

expiration¶

Alias for field number 1

class flask_cookie_decode.cookie_decode.TrustedCookie(contents, expiration)¶

Bases: tuple

contents¶

Alias for field number 0

expiration¶

Alias for field number 1

class flask_cookie_decode.cookie_decode.UntrustedCookie(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:
  1. by Kyle Lawlor.

license:

MIT license , see LICENSE for more details.

Table of Contents

  • flask_cookie_decode package
    • Submodules
    • flask_cookie_decode.cookie_decode module
      • CookieDecode
        • CookieDecode.decode_cookie()
        • CookieDecode.init_app()
      • ExpiredCookie
        • ExpiredCookie.contents
        • ExpiredCookie.expiration
      • TrustedCookie
        • TrustedCookie.contents
        • TrustedCookie.expiration
      • UntrustedCookie
        • UntrustedCookie.contents
        • UntrustedCookie.expiration
    • Module contents
      • flaskext.flask-cookie-decode

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • flask-cookie-decode 0.4.3 documentation »
  • flask_cookie_decode package
© Copyright 2018, Kyle Lawlor. Created using Sphinx 8.2.3.