Skip to main content

Flask Session using Azure Table Storage or CosmosDB table API

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_session_azure-0.3.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

flask_session_azure-0.3.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file flask_session_azure-0.3.4.tar.gz.

File metadata

  • Download URL: flask_session_azure-0.3.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.2

File hashes

Hashes for flask_session_azure-0.3.4.tar.gz
Algorithm Hash digest
SHA256 2d37a4b37cad7edcede72eb3d5486c0fba66068aa2c84c369be09d223f09212c
MD5 50b6fde0a5947e43c9738a19e00cfd8a
BLAKE2b-256 27a437e73e8539f6a619a8c3ce530f617d38f585d76185e6389181cf2bb5beb2

See more details on using hashes here.

File details

Details for the file flask_session_azure-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: flask_session_azure-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.2

File hashes

Hashes for flask_session_azure-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a6363086f45e8d3a53b85a6231669cdf3f0c4dd997ef809e77cad3705c3661f3
MD5 33832e95e05c0d965510d91df11d71f0
BLAKE2b-256 b9b3622022b3c7b262a21d0b47c6f12df983ca8878197413a9e6fd55dd25ada8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page