Skip to content

fix: Update rest session manager when logging in - #1569

Merged
ZohebShaikh merged 5 commits into
mainfrom
client-login
Aug 17, 2026
Merged

ZohebShaikh merged 5 commits into
mainfrom
client-login

Conversation

@tpoliaw

@tpoliaw tpoliaw commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

If the user is not logged in when the client is created, the rest client
does not get a session manager. When the user calls login, a new session
manager is created to cache the new token but if the rest client is not
updated, any subsequent calls remain unauthenticated.

Setting the rest client's session manager to the new instance when a
login is successful means the tokens can be used without recreating the
client.

Now that the login method works as expected, the client created in the
just repl task can now automatically refresh its login if required.

Also adds a logout method to the client so users can log out from the
repl as well.

@tpoliaw tpoliaw linked an issue Jun 25, 2026 that may be closed by this pull request
Comment thread src/blueapi/client/client.py Fixed
@tpoliaw
tpoliaw requested a review from a team as a code owner June 25, 2026 17:50
@codecov

codecov Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.96%. Comparing base (132281d) to head (93126f8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1569   +/-   ##
=======================================
  Coverage   95.96%   95.96%           
=======================================
  Files          45       45           
  Lines        3317     3322    +5     
=======================================
+ Hits         3183     3188    +5     
  Misses        134      134           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tpoliaw added 2 commits June 29, 2026 10:33
If the user is not logged in when the client is created, the rest client
does not get a session manager. When the user calls login, a new session
manager is created to cache the new token but if the rest client is not
updated, any subsequent calls remain unauthenticated.

Setting the rest client's session manager to the new instance when a
login is successful means the tokens can be used without recreating the
client.

Now that the login method works as expected, the client created in the
`just repl` task can now automatically refresh its login if required.
@ZohebShaikh

Copy link
Copy Markdown
Contributor

@tpoliaw Can I add this to the queue ?

@tpoliaw

tpoliaw commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

If github works long enough

@ZohebShaikh
ZohebShaikh added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 17, 2026
@ZohebShaikh
ZohebShaikh added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 17, 2026
@ZohebShaikh
ZohebShaikh added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit 90c569f Aug 17, 2026
21 checks passed
@ZohebShaikh
ZohebShaikh deleted the client-login branch August 17, 2026 16:49
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.

Calling login on a BlueapiClient doesn't allow that client to be used

2 participants