diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2014-05-13 10:30:26 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2014-05-13 10:30:26 -0700 |
commit | de7d28493cbb9cd2ed731116712aafcfe1c93c63 (patch) | |
tree | 3009cca44cfb4d3f684d8354ca3576dd6cd6bdb7 /redis/client.py | |
parent | 09e5819d45860a272c83ea59c8e246fdc1a5be49 (diff) | |
download | redis-py-de7d28493cbb9cd2ed731116712aafcfe1c93c63.tar.gz |
added the ablity to pass ssl options to client classes. #446
Diffstat (limited to 'redis/client.py')
-rwxr-xr-x | redis/client.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py index 59bdf28..bb63435 100755 --- a/redis/client.py +++ b/redis/client.py @@ -7,7 +7,8 @@ import threading import time as mod_time from redis._compat import (b, basestring, bytes, imap, iteritems, iterkeys, itervalues, izip, long, nativestr, unicode) -from redis.connection import ConnectionPool, UnixDomainSocketConnection, Token +from redis.connection import (ConnectionPool, UnixDomainSocketConnection, + SSLConnection, Token) from redis.exceptions import ( ConnectionError, DataError, @@ -389,7 +390,9 @@ class StrictRedis(object): db=0, password=None, socket_timeout=None, connection_pool=None, charset='utf-8', errors='strict', decode_responses=False, - unix_socket_path=None): + unix_socket_path=None, + ssl=False, ssl_keyfile=None, ssl_certfile=None, + ssl_cert_reqs=None, ssl_ca_certs=None): if not connection_pool: kwargs = { 'db': db, @@ -410,6 +413,15 @@ class StrictRedis(object): 'host': host, 'port': port }) + + if ssl: + kwargs.update({ + 'connection_class': SSLConnection, + 'keyfile': ssl_keyfile, + 'certfile': ssl_certfile, + 'cert_reqs': ssl_cert_reqs, + 'ca_certs': ssl_ca_certs, + }) connection_pool = ConnectionPool(**kwargs) self.connection_pool = connection_pool |