Skip to main content

Flask Session using Azure table storage (or cosmosDB table API)

PyPI - License PyPI PyPI - Python Version

This module can be used as a Flask Session handler for Azure table storage or Azure CosmosDB. All stored data is encrypted using AES encryption.

Example usage:

import flask
from flask_session_azure import storage_account_interface

app = flask.Flask(__name__)
app.secret_key = "MyVerySecretEnryptionKeyForEverything" # must be at least 16 characters, the longer the better
connection_string = "DefaultEndpointsProtocol=https;AccountName=someAccount;AccountKey=someKey;EndpointSuffix=core.windows.net"
app.session_interface = storage_account_interface(connection_string)

This will store the session data in a table called flasksession, with a partition key called default_session. IF the table does not yet exists, it will be created the first time a session is stored. You can overwrite these default when creating the session interface:

app.session_interface = storage_account_interface(connection_string, table_name="mytablename", partition_key="app1", create_table_if_not_exists=False)

If you use this in Azure Function, or Azure Web-Service, you most certainly already have a storage account connection in your environment variable AzureWebJobsStorage:

import os
import flask
from flask_session_azure import storage_account_interface

app = flask.Flask(__name__)
app.secret_key = "MyVerySecretEnryptionKeyForEverything" # must be at least 16 characters, the longer the better
connection_string = os.environ.get("AzureWebjobsStorage")
app.session_interface = storage_account_interface(connection_string)

Changelog

0.4.3

  • Fixed issue with secret key length and secret key containing non-asci characters

0.4.2

0.4.1

  • First public release

Metadata

Release files for flask-session-azure 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-session-azure 0.4.3
File Size Uploaded
flask_session_azure-0.4.3.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-session-azure 0.4.3
File Interpreter ABI Platform
flask_session_azure-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / flask_session_azure-0.4.3.tar.gz

Download URL flask_session_azure-0.4.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fcfb854a068e61e47dd739f1fab5dbaf45c352fd8e93deebb3bdcf4b008ead07
BLAKE2b-256 checksum
How to use checksums
cd138faea9da74b02939851a330f6c5de6c565526f59be69334907c8dfc6deb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.2

Release files / flask_session_azure-0.4.3-py3-none-any.whl

Download URL flask_session_azure-0.4.3-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
022493231057183c16ebe2e68412e17aa04ebde452395086c05aac12da8564c0
BLAKE2b-256 checksum
How to use checksums
66acd43134a9f47c4f37e090ea12604c6fba5488cced810569b43cc0ef21773a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page