From 6b0484b9db21e05c96545253c3c484916ffa95ae Mon Sep 17 00:00:00 2001 From: Taras Date: Tue, 5 Jan 2021 13:06:14 +0200 Subject: [PATCH] Modify RedisHandlerBackend, add argument "password=None" to __init__() With argument "password=None" in method __init__(), and argument "password" in "self.redis = Redis(host, port, db, password)", will be able to use Redis with password protection, if password is set . --- telebot/handler_backends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/handler_backends.py b/telebot/handler_backends.py index a10d13c..9b54f7c 100644 --- a/telebot/handler_backends.py +++ b/telebot/handler_backends.py @@ -114,11 +114,11 @@ class FileHandlerBackend(HandlerBackend): class RedisHandlerBackend(HandlerBackend): - def __init__(self, handlers=None, host='localhost', port=6379, db=0, prefix='telebot'): + def __init__(self, handlers=None, host='localhost', port=6379, db=0, prefix='telebot', password=None): super(RedisHandlerBackend, self).__init__(handlers) from redis import Redis self.prefix = prefix - self.redis = Redis(host, port, db) + self.redis = Redis(host, port, db, password) def _key(self, handle_group_id): return ':'.join((self.prefix, str(handle_group_id)))