From ccdaed397293009c942da35a28a1a44c7d1872c8 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 12 May 2023 12:46:11 +0200 Subject: [PATCH] Make sure we're importing redis the library (#2106) ...not the module, if there is one present. --- sentry_sdk/integrations/redis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sentry_sdk/integrations/redis.py b/sentry_sdk/integrations/redis.py index b05bc741f1..22464d8b4c 100644 --- a/sentry_sdk/integrations/redis.py +++ b/sentry_sdk/integrations/redis.py @@ -115,14 +115,14 @@ def __init__(self, max_data_size=_DEFAULT_MAX_DATA_SIZE): def setup_once(): # type: () -> None try: - import redis + from redis import StrictRedis, client except ImportError: raise DidNotEnable("Redis client not installed") - patch_redis_client(redis.StrictRedis, is_cluster=False) - patch_redis_pipeline(redis.client.Pipeline, False, _get_redis_command_args) + patch_redis_client(StrictRedis, is_cluster=False) + patch_redis_pipeline(client.Pipeline, False, _get_redis_command_args) try: - strict_pipeline = redis.client.StrictPipeline # type: ignore + strict_pipeline = client.StrictPipeline # type: ignore except AttributeError: pass else: