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

.url attribute was used before assignment; assign account to unauthen… #322

Merged
merged 6 commits into from
Feb 12, 2024

Conversation

KatKatKateryna
Copy link
Contributor

…ticated client to get token

Description & motivation

Changes:

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

@KatKatKateryna KatKatKateryna marked this pull request as ready for review December 4, 2023 21:52
)
)
self.account = get_default_account()
Copy link
Collaborator

@gjedlicska gjedlicska Dec 6, 2023

Choose a reason for hiding this comment

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

what is the reason for providing a fallback to the default account?

I'm not very much in favor of this, it gives more uncertainty into which account you are actually using, to send stuff. I'd much rather fail with an error, if the transport gets an invalid account.

Copy link
Contributor Author

@KatKatKateryna KatKatKateryna Dec 6, 2023

Choose a reason for hiding this comment

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

In case the ServerTransport is initiated via non-authenticated client (e.g. from Stream Wrapper of a public stream), the the self.account will stay None, and self.session.headers (line 101 in an updated code) will fail ("None has no attribute token"). And the user should be able to receive a public stream from any account

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is a StreamWrapper implementation issue, that we should fix there. Also the type of account is an Optional[Account], so we should do a None check on line 101 and only add an authorization header if we have an actual account.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (d60feb7) 90.25% compared to head (1e971b5) 90.25%.

Files Patch % Lines
src/specklepy/core/api/resources/branch.py 0.00% 1 Missing ⚠️
src/specklepy/core/api/resources/stream.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #322   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files          89       89           
  Lines        5447     5448    +1     
=======================================
+ Hits         4916     4917    +1     
  Misses        531      531           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gjedlicska gjedlicska merged commit 64b61f5 into main Feb 12, 2024
4 of 5 checks passed
@gjedlicska gjedlicska deleted the kate-2.17-hotfix branch February 12, 2024 16:29
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