Merge pull request #7 from rubikscuber/patch-1

respect custom redis uri
This commit is contained in:
Sander
2022-03-10 14:52:40 +02:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -24,6 +24,7 @@ from quart_session import Session
app = Quart(__name__)
app.config['SESSION_TYPE'] = 'redis'
app.config['SESSION_URI'] = 'redis://:password@localhost:6379'
Session(app)
@app.route('/')
+2 -1
View File
@@ -228,8 +228,9 @@ class RedisSessionInterface(SessionInterface):
"""
if self.backend is None:
import aioredis
uri = app.config.get('SESSION_URI', 'redis://localhost')
self.backend = await aioredis.from_url(
"redis://localhost", encoding="utf-8", decode_responses=True
uri, encoding="utf-8", decode_responses=True
)
async def get(self, key: str, app: Quart = None):