We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contactedHave a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Expand Up | @@ -52,7 +52,24 @@ def __str__(self) -> str: | |
|
|
||
|
|
||
| class GitlabAuthenticationError(GitlabError): | ||
| pass | ||
| def __init__( | ||
| self, | ||
| error_message: Union[str, bytes] = "", | ||
| response_code: Optional[int] = None, | ||
| response_body: Optional[bytes] = None, | ||
| auth_type: str = "", | ||
| ) -> None: | ||
| super().__init__( | ||
| error_message=error_message, | ||
| response_code=response_code, | ||
| response_body=response_body, | ||
| ) | ||
| self.auth_type = auth_type | ||
|
Comment thread
Comment on lines
+55
to
+67
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentMaybe we could add **kwargs to GitlabError and we don't need to reimplement it here? Just pop it from kwargs?
Sorry, something went wrong.
All reactions
|
||
|
|
||
| def __str__(self) -> str: | ||
| if self.auth_type: | ||
| return f"{super().__str__()}: authentication_type: {self.auth_type}" | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentIf we decide to infer the auth type automatically I'd maybe reformulate this a bit. Not sure exactly how, just authentication_type sounds like it's a variable name defined/passed somewhere. We can maybe check around how more verbose exceptions do it in cpython or some other libraries.
Sorry, something went wrong.
All reactions
|
||
| return super().__str__() | ||
|
|
||
|
|
||
| class RedirectError(GitlabError): | ||
| Expand Down | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide commentI think we could actually reuse self.headers and pass it (or just the dict keys) to the exception to infer the auth type, without adding custom variables here.
http_username/http_password is basically dead code as HTTP Basic auth has been out of GitLab since version 10 so we don't need to worry about that (I actually have a local draft that performs password-based OAuth login from that). So we're left with Private-Token, Job-Token, and Authorization (OAuth bearer) from headers. We could probably just pass the keys from the headers dict to not leak stuff accidentally.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.