Skip to content
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

introduce AccessToken dataclass #128

Merged
merged 7 commits into from
Feb 27, 2024
Merged

introduce AccessToken dataclass #128

merged 7 commits into from
Feb 27, 2024

Conversation

kacperf531
Copy link
Collaborator

@kacperf531 kacperf531 self-assigned this Feb 2, 2024
@@ -30,3 +33,19 @@ def success(self) -> bool:
def payload(self) -> dict:
''' `payload` from the RTM response. '''
return self.rtm_response.get('payload')


class Scheme(Enum):
Copy link
Collaborator

@skamieniarz skamieniarz Feb 8, 2024

Choose a reason for hiding this comment

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

why scheme and not type? because of python's built-in type?

edit:
also, it's a top-level definition without a direct link to the token, so i would consider TokenType or sth. importing from livechat.utils.structures import Scheme does not clearly indicate what scheme we are actually dealing with

for key, value in parameters.items()
if key not in ['self', 'payload', 'headers', 'date_to', 'date_from']
for key, value in parameters.items() if key not in
['self', 'payload', 'token', 'headers', 'date_to', 'date_from']
Copy link
Collaborator

Choose a reason for hiding this comment

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

it requires adding:

        if token:
            payload['token'] = str(token)

several times. what is the reason here? do you think the current way of adding a token to the payload is too implicit or is it a matter of type conversion to str?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's a trade-off, because JSON serializer doesn't know what to do with this AccessToken object (and I haven't found easy way to make it json-serialazible easily in python), but I did it a bit differently in the post-review fixes

Copy link
Collaborator

@zuczkows zuczkows left a comment

Choose a reason for hiding this comment

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

looks good, but add note to changelog

@kacperf531 kacperf531 merged commit ee811e1 into master Feb 27, 2024
1 check passed
@kacperf531 kacperf531 deleted the fix-issue-#126 branch February 27, 2024 11:25
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.

3 participants