From 578cc3be085e99739cb36ad37961a4e16e4d81d4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 1 Nov 2023 16:34:14 +0800 Subject: [PATCH] bugfix --- ahserver/auth_api.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index fa535a9..f34c980 100755 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -29,9 +29,13 @@ class MyRedisStorage(RedisStorage): def key_gen(self, request): key = request.headers.get('client_uuid') if not key: - return uuid.uuid4().hex - b = key.encode('utf-8') - return binascii.hexlify(b) + key = uuid.uuid4().hex + return key + if isinstance(key, str): + key = key.encode('utf-8') + key = binascii.hexlify(key) + key = key.decode('utf-8') + return key async def save_session(self, request: web.Request, response: web.StreamResponse,