summaryrefslogtreecommitdiff
path: root/redis/exceptions.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2020-01-31 12:18:12 -0800
committerAndy McCurdy <andy@andymccurdy.com>2020-01-31 12:18:12 -0800
commite39ae455dfa259cdbb0c1cee2e4cb50c17ee22bf (patch)
tree342683bbb84d6d55c54bc166cae1dac82becf8a1 /redis/exceptions.py
parentab1c659aaac8a59c4e4055e1598920706192fa42 (diff)
downloadredis-py-e39ae455dfa259cdbb0c1cee2e4cb50c17ee22bf.tar.gz
Provide AUTH fallback support for connection URLs with a username component
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 managed Redis instances (like Heroku) provide connection URLs with a username component pre-ACL that is not intended to be used. Sending that username to Redis servers < 6.0.0 results in an error. Attempt to detect this condition and retry the AUTH command with only the password such that authentication continues to work for these users. Fixes #1274
Diffstat (limited to 'redis/exceptions.py')
-rw-r--r--redis/exceptions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/redis/exceptions.py b/redis/exceptions.py
index 6f47024..760af66 100644
--- a/redis/exceptions.py
+++ b/redis/exceptions.py
@@ -72,3 +72,11 @@ class LockNotOwnedError(LockError):
class ChildDeadlockedError(Exception):
"Error indicating that a child process is deadlocked after a fork()"
pass
+
+
+class AuthenticationWrongNumberOfArgsError(ResponseError):
+ """
+ An error to indicate that the wrong number of args
+ were sent to the AUTH command
+ """
+ pass