-
Notifications
You must be signed in to change notification settings - Fork 1.2k
src: Add authorize and basic to Printer #22699
New issue
Have 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
base: main
Are you sure you want to change the base?
Conversation
Allows us to use Basic authorize without base64-encoding ourselves before using the command. Signed-off-by: Freya Gustavsson <[email protected]>
allisonkarlitskaya
left a comment
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.
Thanks for this!
The --compact thing would be cool too!
| """Send a control message, build from **kwargs""" | ||
| self.json('', command=command, **kwargs) | ||
|
|
||
| def authorize(self, cookie: str, b64_content: str, auth_type: str = "Basic", **kwargs: Any) -> None: |
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.
Probably make that just take the "response" as a single string instead of two strings stuck together?
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.
We can't use colon due to it being a limited character. Some parsing thing done in the main function
That's why I split it up
| encoded_response = f"{auth_type} {b64_content}" | ||
| self.json('', command="authorize", cookie=cookie, response=encoded_response, **kwargs) | ||
|
|
||
| def basic(self, cookie: str, user: str, password: str, **kwargs: Any) -> None: |
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.
I'd also take the user:pass as a single string that the user is expected to provide their own : for. I feel less strongly about this one, though.
Allows us to use Basic authorize without base64-encoding ourselves
before using the command.
Signed-off-by: Freya Gustavsson [email protected]