2 Commits

Author SHA1 Message Date
dsc 121f8a5f8d Update README 2020-01-05 15:19:21 +01:00
dsc ce58ecb1df Redis+Trio support 2020-01-05 15:10:16 +01:00
5 changed files with 9 additions and 22 deletions
View File
-9
View File
@@ -1,9 +0,0 @@
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
+7 -8
View File
@@ -1,6 +1,4 @@
# 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
Quart-Session is an extension for Quart that adds support for
server-side sessions to your application.
@@ -57,13 +55,13 @@ app.config['SESSION_TYPE'] = 'redis'
@app.before_serving
async def setup():
cache = await aioredis.create_redis_pool(...)
cache = await aioredis.create_redis_pool({"address": "..."})
app.config['SESSION_REDIS'] = cache
Session(app)
```
By default, Quart-session creates a single connection to Redis, while
the example above sets up a connection pool.
the example above creates a connection pool.
#### Trio support
@@ -151,9 +149,9 @@ To re-gain the old behaviour of always emitting a `Set-Cookie` header on static
set `SESSION_STATIC_FILE` to `True`.
### Session pinning
### Session hijack prevention
Associates an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
(Optionally) pins an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
for paranoid web applications.
```python3
@@ -163,7 +161,8 @@ app.config['SESSION_HIJACK_PROTECTION'] = True
Session(app)
```
Session reuse from a different IP will now result in the creation of a new session, and the deletion of the old.
With this option, session reuse from a different IP will 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,6 +13,7 @@
__version__ = '0.0.1'
import os
import sniffio
from typing import Optional
from quart import Quart
+1 -5
View File
@@ -14,9 +14,6 @@ Links
"""
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
INSTALL_REQUIRES = [
"Quart>=0.10.0"
@@ -30,8 +27,7 @@ setup(
author='dsc',
author_email='dsc@xmr.pm',
description='Adds server-side session support to your Quart application',
long_description=long_description,
long_description_content_type='text/markdown',
long_description=__doc__,
packages=['quart_session'],
zip_safe=False,
include_package_data=True,