summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2014-05-13 10:41:23 -0700
committerAndy McCurdy <andy@andymccurdy.com>2014-05-13 10:41:23 -0700
commit17ff3774a74a251f17ffb1235b8d38a17fa1b13f (patch)
treeac1993c23c46b4d38dbbd63e9f1ca137936cfd9d
parentde7d28493cbb9cd2ed731116712aafcfe1c93c63 (diff)
downloadredis-py-17ff3774a74a251f17ffb1235b8d38a17fa1b13f.tar.gz
construct SSL connections from URLs. #446
-rwxr-xr-xredis/connection.py9
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))