Remove DigestAuthWorkaround, require Prusa firmware 5.2.0+#155
Conversation
f203644 to
62b41d4
Compare
From what I know Prusa printers don't usually auto-update, so there might be users with older firmware no? Is there any pressing need to remove this workaround? |
No real pressing need. Just wanted to clean it up and keep the code more maintainable (even if it's a small thing). Users should really upgrade as there are so many improvements in the newer ones, so I thought this could be a nice incentive to encourage upgrading as well. Main motive of this patch is actually to have the discussion about it with someone :) I'm ok with leaving it out for now. |
100% agree, and I just checked, mine is on 6.4.0, so quite a bit newer. However, I guess quite some Home Assistant user don't use Prusa Connect (I also do not), so if they did not use their printer a lot, maybe its still on an old firmware. I wonder if we could add an update entity to Home Assistant? 🤔
Ok let's leave the workaround in place for now. |
Both upstream bugs that motivated the workaround are now fixed: - encode/httpx#3045 (httpx 0.27.0, 2024-02-21) - prusa3d/Prusa-Firmware-Buddy#3665 (firmware 5.2.0, 2024-02-06) Drops the DigestAuthWorkaround subclass and uses httpx.DigestAuth directly. Bumps the minimum httpx dependency to 0.27.0 and documents the firmware requirement in README.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62b41d4 to
478fa8b
Compare
heikkih
left a comment
There was a problem hiding this comment.
I wonder if we could add an update entity to Home Assistant? 🤔
This is in my plan :)
|
Marking as draft for now — agreed with maintainer to hold off on removing the DigestAuthWorkaround until there's been more time to confirm the firmware 5.2.0 requirement won't break existing users. |
Summary
Removes the
DigestAuthWorkaroundsubclass and useshttpx.DigestAuthdirectly.This is the second PR in a series of improvements to pyprusalink and the Home Assistant
prusalinkintegration (first PR: #154).Background
The workaround was introduced to handle two bugs:
algorithmparameterBoth fixes are over a year old. The firmware fix was confirmed present in v5.2.0 via commit
9123619e0bin that release's history.Changes
pyprusalink/client.py: RemovesDigestAuthWorkaround(and the now-unusedhashlib,Request,_DigestAuthChallengeimports).ApiClientnow setsself._auth = DigestAuth(...)directly.pyproject.toml: Pinshttpx>=0.27.0to ensure the fixed version is always used.README.md: Documents the firmware 5.2.0 minimum requirement.tests/test_client.py: Replaces the two workaround behaviour tests with a single assertion thattype(api._auth) is httpx.DigestAuth.Test plan
pytest tests/ -v— 14 passedflake8 pyprusalink tests— no errorsblack --check pyprusalink tests— no reformats neededisort --check pyprusalink tests— no changes needed🤖 Generated with Claude Code