Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add username params for redis authentication #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions RedisLibrary/RedisLibraryKeywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ def get_redis_master(self, redis_host, redis_port=26379, service_name=None):
return sentinel_detail

@keyword('Connect To Redis')
def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=None, ssl=False, ssl_ca_certs=None):
def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=None, redis_username=None, ssl=False, ssl_ca_certs=None):
"""Connect to the Redis server.

Arguments:
- redis_host: hostname or IP address of the Redis server.
- redis_port: Redis port number (default=6379)
- db: Redis keyspace number (default=0)
- redis_username: username for Redis authentication
- redis_password: password for Redis authentication
- ssl: Connect Redis with SSL or not (default is False)
- ssl_ca_certs: CA Certification when connect Redis with SSL
Expand All @@ -76,7 +77,7 @@ def connect_to_redis(self, redis_host, redis_port=6379, db=0, redis_password=Non
"""
try:
redis_conn = redis.StrictRedis(host=redis_host, port=redis_port, db=db,
password=redis_password, ssl=ssl, ssl_ca_certs=ssl_ca_certs)
username=redis_username, password=redis_password, ssl=ssl, ssl_ca_certs=ssl_ca_certs)
except Exception as ex:
logger.error(str(ex))
raise Exception(str(ex))
Expand Down
Loading