Skip to main content

Flask Session using Azure Table Storage or CosmosDB table API

Project description

Flask Session using Azure table storage (Using Azure-Data-Tables Library)

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.5

  • Edited functions to use updated Azure-Core library instead of deprecated Azure-Common. Updated flask elements to use newer app.config format.

0.4.4

  • Edited functions to use the Azure-Data-Tables library that is actively maintained by Microsoft

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

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_c-0.4.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_session_azure_c-0.4.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file flask_session_azure_c-0.4.5.tar.gz.

File metadata

  • Download URL: flask_session_azure_c-0.4.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for flask_session_azure_c-0.4.5.tar.gz
Algorithm Hash digest
SHA256 5d3b6fa3ab5512ae897a71ebced9dfbdb440d3888c33c24156263fb642fd918a
MD5 241e332ce85de2a538c8f08ff0bb7fdd
BLAKE2b-256 499ff09bc27df6e82110e1562a4b980c129a7baca44f33de8492d13f1f92ba02

See more details on using hashes here.

File details

Details for the file flask_session_azure_c-0.4.5-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_session_azure_c-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a3f106e66f8b0d92a9c6d46854f238f6865a08fab54a18eff85cbd84365a2ee2
MD5 6bc3a6d79ef01ac14842c1d0047634ee
BLAKE2b-256 432e47d8274fbc60bdd35ca251618e2b20f3c6685502f3832e5125acad055bfa

See more details on using hashes here.

Supported by

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