-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add --password flag for providing API password #74
Add --password flag for providing API password #74
Conversation
24d7c16
to
d113643
Compare
I only didn't add it since I was always using token - hoping someone else would do it if we needed it :) If you fix the error/issues the hound found I'm fine merging this in, having a basic test for it will be awesome. You can look at extending test_defaults.py or add your own for it. |
@@ -64,6 +64,8 @@ def restapi( | |||
|
|||
if ctx.token: | |||
headers["Authorization"] = "Bearer {}".format(ctx.token) | |||
if ctx.password is not None: | |||
headers["x-ha-access"] = ctx.password |
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.
adding both headers will never make sense - but it also don't really hurt so let's just keep it simple.
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.
Is there maybe some way to tell click to output an error if both, token and password, are provided?
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.
It seems there is none but we can easily implement our own: pallets/click#257. Should I do that?
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 think that would be great, but i'm ok if you do that as a separate pr since its mainly a nice to have.
a4e9de3
to
0a9fa31
Compare
0a9fa31
to
aa60fca
Compare
Added a test case for |
Tested this and works! Thanks @dotlambda |
I was not sure if it was right thing to add
HASSIO_PASSWORD
.Should I add tests for this functionality?