-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from SergeyTsaplin/password-auth
Password-based authentication support
- Loading branch information
Showing
11 changed files
with
339 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,6 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# idea | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# All of the custom errors are inherited from the grpc.RpcError | ||
# for the backward compatibility | ||
from grpc import RpcError, StatusCode | ||
|
||
|
||
class EtcdError(RpcError): | ||
code = StatusCode.UNKNOWN | ||
|
||
def __init__(self, details, debug_info=None): | ||
self.details = details | ||
self.debug_info = debug_info | ||
|
||
def __repr__(self): | ||
return "`{}`: reason: `{}`".format(self.code, self.details) | ||
|
||
|
||
class AuthError(EtcdError): | ||
code = StatusCode.INVALID_ARGUMENT | ||
|
||
|
||
class Unauthenticated(EtcdError): | ||
code = StatusCode.UNAUTHENTICATED | ||
|
||
|
||
class InvalidArgument(EtcdError): | ||
code = StatusCode.INVALID_ARGUMENT | ||
|
||
|
||
class PermissionDenied(EtcdError): | ||
code = StatusCode.PERMISSION_DENIED | ||
|
||
|
||
class FailedPrecondition(EtcdError): | ||
code = StatusCode.FAILED_PRECONDITION | ||
|
||
|
||
STATUS_MAP = { | ||
StatusCode.UNAUTHENTICATED: Unauthenticated, | ||
StatusCode.PERMISSION_DENIED: PermissionDenied, | ||
StatusCode.FAILED_PRECONDITION: FailedPrecondition, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
from setuptools import setup, find_packages | ||
|
||
version = "1.11" | ||
version = "1.12" | ||
|
||
try: | ||
import pypandoc | ||
|
Oops, something went wrong.