summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2020-01-31 12:28:16 -0800
committerAndy McCurdy <andy@andymccurdy.com>2020-01-31 12:28:16 -0800
commit5a1f3c448063b3e30d3283cd93ef50973abc3806 (patch)
treee31f49f0cb02494041939f2bc224976de6b95fd3
parente39ae455dfa259cdbb0c1cee2e4cb50c17ee22bf (diff)
downloadredis-py-5a1f3c448063b3e30d3283cd93ef50973abc3806.tar.gz
Move the username argument in the Redis and Connection classes to the end
This helps those poor souls that specify all their connection options as non-keyword arguments. Fixes #1276
-rw-r--r--CHANGES3
-rwxr-xr-xredis/client.py4
-rwxr-xr-xredis/connection.py11
3 files changed, 10 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index bbf51e8..9d47f50 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
* 3.4.1 (in development)
+ * Move the username argument in the Redis and Connection classes to the
+ end of the argument list. This helps those poor souls that specify all
+ their connection options as non-keyword arguments. #1276
* Prior to ACL support, redis-py ignored the username component of
Connection URLs. With ACL support, usernames are no longer ignored and
are used to authenticate against an ACL rule. Some cloud vendors with
diff --git a/redis/client.py b/redis/client.py
index 3ad9f12..040d131 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -674,7 +674,7 @@ class Redis(object):
return cls(connection_pool=connection_pool)
def __init__(self, host='localhost', port=6379,
- db=0, username=None, password=None, socket_timeout=None,
+ db=0, password=None, socket_timeout=None,
socket_connect_timeout=None,
socket_keepalive=None, socket_keepalive_options=None,
connection_pool=None, unix_socket_path=None,
@@ -685,7 +685,7 @@ class Redis(object):
ssl_cert_reqs='required', ssl_ca_certs=None,
ssl_check_hostname=False,
max_connections=None, single_connection_client=False,
- health_check_interval=0, client_name=None):
+ health_check_interval=0, client_name=None, username=None):
if not connection_pool:
if charset is not None:
warnings.warn(DeprecationWarning(
diff --git a/redis/connection.py b/redis/connection.py
index a013145..bf892e9 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -490,14 +490,13 @@ else:
class Connection(object):
"Manages TCP communication to and from a Redis server"
- def __init__(self, host='localhost', port=6379, db=0, username=None,
- password=None, socket_timeout=None,
- socket_connect_timeout=None, socket_keepalive=False,
- socket_keepalive_options=None, socket_type=0,
- retry_on_timeout=False, encoding='utf-8',
+ def __init__(self, host='localhost', port=6379, db=0, password=None,
+ socket_timeout=None, socket_connect_timeout=None,
+ socket_keepalive=False, socket_keepalive_options=None,
+ socket_type=0, retry_on_timeout=False, encoding='utf-8',
encoding_errors='strict', decode_responses=False,
parser_class=DefaultParser, socket_read_size=65536,
- health_check_interval=0, client_name=None):
+ health_check_interval=0, client_name=None, username=None):
self.pid = os.getpid()
self.host = host
self.port = int(port)