diff --git a/quart_session/sessions.py b/quart_session/sessions.py index acb3161..77c2c20 100644 --- a/quart_session/sessions.py +++ b/quart_session/sessions.py @@ -228,8 +228,9 @@ class RedisSessionInterface(SessionInterface): """ if self.backend is None: import aioredis - self.backend = await aioredis.create_redis( - "redis://localhost") + self.backend = await aioredis.from_url( + "redis://localhost", encoding="utf-8", decode_responses=True + ) async def get(self, key: str, app: Quart = None): return await self.backend.get(key) @@ -239,8 +240,8 @@ class RedisSessionInterface(SessionInterface): if app and not expiry: expiry = total_seconds(app.permanent_session_lifetime) return await self.backend.setex( - key=key, value=value, - seconds=expiry) + name=key, value=value, + time=expiry) async def delete(self, key: str, app: Quart = None): return await self.backend.delete(key) diff --git a/setup.py b/setup.py index e6201aa..cf2fd39 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,10 @@ setup( platforms='any', install_requires=INSTALL_REQUIRES, tests_require=INSTALL_REQUIRES + ["asynctest", "hypothesis", "pytest", "pytest-asyncio"], - extras_require={"dotenv": ["python-dotenv"]}, + extras_require={ + "dotenv": ["python-dotenv"], + "redis": ["aioredis>=2.0.0"] + }, classifiers=[ 'Environment :: Web Environment', 'Intended Audience :: Developers',