diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2014-05-13 10:41:23 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2014-05-13 10:41:23 -0700 |
commit | 17ff3774a74a251f17ffb1235b8d38a17fa1b13f (patch) | |
tree | ac1993c23c46b4d38dbbd63e9f1ca137936cfd9d | |
parent | de7d28493cbb9cd2ed731116712aafcfe1c93c63 (diff) | |
download | redis-py-17ff3774a74a251f17ffb1235b8d38a17fa1b13f.tar.gz |
construct SSL connections from URLs. #446
-rwxr-xr-x | redis/connection.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/redis/connection.py b/redis/connection.py index a826602..5607508 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -635,8 +635,14 @@ class ConnectionPool(object): For example:: redis://[:password]@localhost:6379/0 + rediss://[:password]@localhost:6379/0 unix://[:password]@/path/to/socket.sock?db=0 + Three URL schemes are supported: + redis:// creates a normal TCP socket connection + rediss:// creates a SSL wrapped TCP socket connection + unix:// creates a Unix Domain Socket connection + There are several ways to specify a database number. The parse function will return the first specified option: 1. A ``db`` querystring option, e.g. redis://localhost?db=0 @@ -693,6 +699,9 @@ class ConnectionPool(object): except (AttributeError, ValueError): pass + if url.scheme == 'rediss': + url_options['connection_class'] = SSLConnection + # last shot at the db value url_options['db'] = int(url_options.get('db', db or 0)) |