Skip to content

Add unregister endpoint and automatically unregister on close#25

Merged
iMicknl merged 5 commits intomasterfrom
enhancement/unregister_eventlistener_v2
Jul 29, 2020
Merged

Add unregister endpoint and automatically unregister on close#25
iMicknl merged 5 commits intomasterfrom
enhancement/unregister_eventlistener_v2

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Jul 29, 2020

No description provided.

@iMicknl iMicknl requested review from tetienne and vlebourl July 29, 2020 11:01
Comment thread tahoma_api/client.py Outdated
@iMicknl iMicknl requested a review from tetienne July 29, 2020 13:04
Comment thread tahoma_api/client.py Outdated
Comment thread tahoma_api/client.py Outdated
Comment thread tahoma_api/client.py
response = await self.__post("events/register")
listener_id = response.get("id")
self.event_listener = listener_id
self.event_listener_id = listener_id
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the variable listener_id is useless. But it's ok.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tetienne I agree. However linter was complaining about the fact that it could be str or None. Instead of str.

Is there a way to annotate that response.get("id") will return a string always

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.get will return None if the key can not be found. Try with response["id"].

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tetienne same. I will keep it like this for now.

tahoma_api/client.py:111: error: Incompatible return value type (got "Optional[str]", expected "str")

@iMicknl iMicknl merged commit 2df6a06 into master Jul 29, 2020
@iMicknl iMicknl deleted the enhancement/unregister_eventlistener_v2 branch July 29, 2020 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants