Skip to content

Commit 3848b57

Browse files
committed
Extended CredentialProvider interface with async API
1 parent 833968d commit 3848b57

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

redis/credentials.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class CredentialProvider:
1010
def get_credentials(self) -> Union[Tuple[str], Tuple[str, str]]:
1111
raise NotImplementedError("get_credentials must be implemented")
1212

13+
async def get_credentials_async(self) -> Union[Tuple[str], Tuple[str, str]]:
14+
raise NotImplementedError("get_credentials_async must be implemented")
15+
1316

1417
class StreamingCredentialProvider(CredentialProvider, ABC):
1518
"""
@@ -34,7 +37,6 @@ def is_streaming(self) -> bool:
3437
pass
3538

3639

37-
3840
class UsernamePasswordCredentialProvider(CredentialProvider):
3941
"""
4042
Simple implementation of CredentialProvider that just wraps static
@@ -49,3 +51,8 @@ def get_credentials(self):
4951
if self.username:
5052
return self.username, self.password
5153
return (self.password,)
54+
55+
async def get_credentials_async(self) -> Union[Tuple[str], Tuple[str, str]]:
56+
if self.username:
57+
return self.username, self.password
58+
return (self.password,)

0 commit comments

Comments
 (0)