3 Commits

Author SHA1 Message Date
dsc 08ee20ac07 Release 0.0.1 2020-01-05 17:00:46 +01:00
dsc 6a51c15dbf Update README 2020-01-05 15:31:36 +01:00
dsc df20bbff18 Redis+Trio support 2020-01-05 15:31:32 +01:00
5 changed files with 22 additions and 9 deletions
View File
+9
View File
@@ -0,0 +1,9 @@
include LICENSE
include CHANGELOG.md
include README.md
include setup.cfg
recursive-include quart_session *.py
recursive-include quart_session *.md
exclude .gitlab-ci.yml
exclude examples
exclude docs
+8 -7
View File
@@ -1,4 +1,6 @@
# Quart-session
# Quart-Session
![pyversions](https://img.shields.io/pypi/pyversions/Quart-Session.svg) [![pypiversion](https://badge.fury.io/py/Quart-Session.svg)](https://pypi.org/project/Quart-Session/) ![PyPI license](https://img.shields.io/pypi/l/Quart-Session.svg)
Quart-Session is an extension for Quart that adds support for
server-side sessions to your application.
@@ -55,13 +57,13 @@ app.config['SESSION_TYPE'] = 'redis'
@app.before_serving
async def setup():
cache = await aioredis.create_redis_pool({"address": "..."})
cache = await aioredis.create_redis_pool(...)
app.config['SESSION_REDIS'] = cache
Session(app)
```
By default, Quart-session creates a single connection to Redis, while
the example above creates a connection pool.
the example above sets up a connection pool.
#### Trio support
@@ -149,9 +151,9 @@ To re-gain the old behaviour of always emitting a `Set-Cookie` header on static
set `SESSION_STATIC_FILE` to `True`.
### Session hijack prevention
### Session pinning
(Optionally) pins an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
Associates an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
for paranoid web applications.
```python3
@@ -161,8 +163,7 @@ app.config['SESSION_HIJACK_PROTECTION'] = True
Session(app)
```
With this option, session reuse from a different IP will result in the
creation of a new session, and the deletion of the old.
Session reuse from a different IP will now result in the creation of a new session, and the deletion of the old.
**Important:** If your application is behind a reverse proxy, it most
likely provides the `X-Forwarded-For` header which you **must** make use of
-1
View File
@@ -13,7 +13,6 @@
__version__ = '0.0.1'
import os
import sniffio
from typing import Optional
from quart import Quart
+5 -1
View File
@@ -14,6 +14,9 @@ Links
"""
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
INSTALL_REQUIRES = [
"Quart>=0.10.0"
@@ -27,7 +30,8 @@ setup(
author='dsc',
author_email='dsc@xmr.pm',
description='Adds server-side session support to your Quart application',
long_description=__doc__,
long_description=long_description,
long_description_content_type='text/markdown',
packages=['quart_session'],
zip_safe=False,
include_package_data=True,