-
Notifications
You must be signed in to change notification settings - Fork 31
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 logout API method #107
Conversation
Thanks @rhpijnacker! Do you use this with Home Assistant as well, or just in a seperate Python script? |
@iMicknl, I am testing this using the example script on the GitHub page. The ultimate goal would be to use this in Home Assistant. |
Oops, I missed that you replied here; iMicknl/ha-sagemcom-fast#19 (comment). Happy to merge it in and bring it to HA. |
sagemcom_api/client.py
Outdated
} | ||
|
||
response = await self.__api_request_async([actions], True) | ||
data = self.__get_response(response) |
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 guess this __get_response
is not actually necessary?
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.
You can remove it indeed, since we don't do anything with the response. What is the response?
Not sure if we want to throw a bool (True/False depending on the logout result).
@@ -172,10 +172,6 @@ def __get_response_value(self, response, index=0): | |||
|
|||
async def __api_request_async(self, actions, priority=False): | |||
"""Build request to the internal JSON-req API.""" | |||
# Auto login | |||
if self._server_nonce == "" and actions[0]["method"] != "logIn": |
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.
Why has this been removed? :)
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.
This was already part of the other PR I assume :-). Otherwise we can reopen. |
While running the Getting Started example, the KPN Box 12 keeps returning XMO_MAX_SESSION_COUNT_ERR errors.
This is simply fixed by adding a logout API method and calling this in a try / finally block.