1818import aiohttp_session
1919import aiohttp_session .redis_storage
2020
21- import aioredis
22- import aioredis .sentinel
21+ from redis import asyncio as aioredis
2322
2423from oidcrp .rp_handler import RPHandler
2524
@@ -122,12 +121,12 @@ async def on_prepare(
122121 redis_user = str (os .environ .get ("SWIFT_UI_REDIS_USER" , "" ))
123122 redis_password = str (os .environ .get ("SWIFT_UI_REDIS_PASSWORD" , "" ))
124123
125- redis : aioredis .Redis
124+ redis_client : aioredis .Redis
126125 if sentinel_url and sentinel_port :
127126 # we forward the auth to redis so no need for auth on sentinel
128127 sentinel = aioredis .sentinel .Sentinel ([(str (sentinel_url ), int (sentinel_port ))])
129128
130- redis = sentinel .master_for (
129+ redis_client = sentinel .master_for (
131130 service_name = sentinel_master ,
132131 redis_class = aioredis .Redis ,
133132 password = redis_password ,
@@ -140,9 +139,11 @@ async def on_prepare(
140139 redis_creds = ""
141140 if redis_user and redis_password :
142141 redis_creds = f"{ redis_user } :{ redis_password } @"
143- redis = aioredis .from_url (f"redis://{ redis_creds } { redis_host } :{ redis_port } " )
142+ redis_client = aioredis .from_url (
143+ f"redis://{ redis_creds } { redis_host } :{ redis_port } "
144+ )
144145 storage = aiohttp_session .redis_storage .RedisStorage (
145- redis ,
146+ redis_client ,
146147 cookie_name = "SWIFT_UI_SESSION" ,
147148 )
148149 app ["seckey" ] = base64 .urlsafe_b64decode (cryptography .fernet .Fernet .generate_key ())
0 commit comments