Реализовать ЛР 7 на оценку 3
This commit is contained in:
+7
-1
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from uuid import UUID
|
||||
|
||||
@@ -11,7 +12,12 @@ from ..domain.errors import Unavailable
|
||||
|
||||
|
||||
def create_redis(url: str) -> Redis:
|
||||
return Redis.from_url(url, decode_responses=True, socket_connect_timeout=3, socket_timeout=3)
|
||||
tls_options = {}
|
||||
if url.startswith('rediss://'):
|
||||
tls_options = {'ssl_ca_certs': os.getenv('TLS_CA_FILE'), 'ssl_check_hostname': True}
|
||||
return Redis.from_url(
|
||||
url, decode_responses=True, socket_connect_timeout=3, socket_timeout=3, **tls_options
|
||||
)
|
||||
|
||||
|
||||
class RedisSessionStore:
|
||||
|
||||
Reference in New Issue
Block a user