forked from mirror/ledisdb
delete code about unsupported feature like password and SSL connection
This commit is contained in:
parent
cdb6b1cdd2
commit
7c4c9b1378
|
@ -112,8 +112,8 @@ class Ledis(object):
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
redis://[:password]@localhost:6380/0
|
redis://localhost:6380/0
|
||||||
unix://[:password]@/path/to/socket.sock?db=0
|
unix:///path/to/socket.sock?db=0
|
||||||
|
|
||||||
There are several ways to specify a database number. The parse function
|
There are several ways to specify a database number. The parse function
|
||||||
will return the first specified option:
|
will return the first specified option:
|
||||||
|
|
|
@ -145,7 +145,7 @@ DefaultParser = PythonParser
|
||||||
|
|
||||||
class Connection(object):
|
class Connection(object):
|
||||||
"Manages TCP communication to and from a Ledis server"
|
"Manages TCP communication to and from a Ledis server"
|
||||||
def __init__(self, host='localhost', port=6380, db=0, password=None,
|
def __init__(self, host='localhost', port=6380, db=0,
|
||||||
socket_timeout=None, encoding='utf-8',
|
socket_timeout=None, encoding='utf-8',
|
||||||
encoding_errors='strict', decode_responses=False,
|
encoding_errors='strict', decode_responses=False,
|
||||||
parser_class=DefaultParser):
|
parser_class=DefaultParser):
|
||||||
|
@ -153,7 +153,6 @@ class Connection(object):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.db = db
|
self.db = db
|
||||||
self.password = password
|
|
||||||
self.socket_timeout = socket_timeout
|
self.socket_timeout = socket_timeout
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
self.encoding_errors = encoding_errors
|
self.encoding_errors = encoding_errors
|
||||||
|
@ -201,12 +200,6 @@ class Connection(object):
|
||||||
"Initialize the connection, authenticate and select a database"
|
"Initialize the connection, authenticate and select a database"
|
||||||
self._parser.on_connect(self)
|
self._parser.on_connect(self)
|
||||||
|
|
||||||
# if a password is specified, authenticate
|
|
||||||
if self.password:
|
|
||||||
self.send_command('AUTH', self.password)
|
|
||||||
if nativestr(self.read_response()) != 'OK':
|
|
||||||
raise AuthenticationError('Invalid Password')
|
|
||||||
|
|
||||||
# if a database is specified, switch to it
|
# if a database is specified, switch to it
|
||||||
if self.db:
|
if self.db:
|
||||||
self.send_command('SELECT', self.db)
|
self.send_command('SELECT', self.db)
|
||||||
|
@ -283,14 +276,12 @@ class Connection(object):
|
||||||
|
|
||||||
|
|
||||||
class UnixDomainSocketConnection(Connection):
|
class UnixDomainSocketConnection(Connection):
|
||||||
def __init__(self, path='', db=0, password=None,
|
def __init__(self, path='', db=0, socket_timeout=None, encoding='utf-8',
|
||||||
socket_timeout=None, encoding='utf-8',
|
|
||||||
encoding_errors='strict', decode_responses=False,
|
encoding_errors='strict', decode_responses=False,
|
||||||
parser_class=DefaultParser):
|
parser_class=DefaultParser):
|
||||||
self.pid = os.getpid()
|
self.pid = os.getpid()
|
||||||
self.path = path
|
self.path = path
|
||||||
self.db = db
|
self.db = db
|
||||||
self.password = password
|
|
||||||
self.socket_timeout = socket_timeout
|
self.socket_timeout = socket_timeout
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
self.encoding_errors = encoding_errors
|
self.encoding_errors = encoding_errors
|
||||||
|
@ -326,13 +317,11 @@ class ConnectionPool(object):
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
redis://[:password]@localhost:6379/0
|
redis://localhost:6380/0
|
||||||
rediss://[:password]@localhost:6379/0
|
unix:///path/to/socket.sock?db=0
|
||||||
unix://[:password]@/path/to/socket.sock?db=0
|
|
||||||
|
|
||||||
Three URL schemes are supported:
|
Three URL schemes are supported:
|
||||||
redis:// creates a normal TCP socket connection
|
redis:// creates a normal TCP socket connection
|
||||||
rediss:// creates a SSL wrapped TCP socket connection
|
|
||||||
unix:// creates a Unix Domain Socket connection
|
unix:// creates a Unix Domain Socket connection
|
||||||
|
|
||||||
There are several ways to specify a database number. The parse function
|
There are several ways to specify a database number. The parse function
|
||||||
|
@ -371,7 +360,6 @@ class ConnectionPool(object):
|
||||||
# We only support redis:// and unix:// schemes.
|
# We only support redis:// and unix:// schemes.
|
||||||
if url.scheme == 'unix':
|
if url.scheme == 'unix':
|
||||||
url_options.update({
|
url_options.update({
|
||||||
'password': url.password,
|
|
||||||
'path': url.path,
|
'path': url.path,
|
||||||
'connection_class': UnixDomainSocketConnection,
|
'connection_class': UnixDomainSocketConnection,
|
||||||
})
|
})
|
||||||
|
@ -380,7 +368,6 @@ class ConnectionPool(object):
|
||||||
url_options.update({
|
url_options.update({
|
||||||
'host': url.hostname,
|
'host': url.hostname,
|
||||||
'port': int(url.port or 6380),
|
'port': int(url.port or 6380),
|
||||||
'password': url.password,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# If there's a path argument, use it as the db argument if a
|
# If there's a path argument, use it as the db argument if a
|
||||||
|
@ -391,9 +378,6 @@ class ConnectionPool(object):
|
||||||
except (AttributeError, ValueError):
|
except (AttributeError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if url.scheme == 'lediss':
|
|
||||||
url_options['connection_class'] = SSLConnection
|
|
||||||
|
|
||||||
# last shot at the db value
|
# last shot at the db value
|
||||||
url_options['db'] = int(url_options.get('db', db or 0))
|
url_options['db'] = int(url_options.get('db', db or 0))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue