-
Notifications
You must be signed in to change notification settings - Fork 1
Form encode on login.cgi #101
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
Conversation
WalkthroughRefactors the AirOS login flow to fall through to a dedicated alternative v6 URL using form_data with ct_form. Updates error handling and return path. Adds a changelog entry for 0.5.5 documenting the login change and bumps the project version to 0.5.5. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant AirOSBase as AirOS Base
participant Device as AirOS Device
Client->>AirOSBase: login()
rect rgb(235, 245, 255)
note right of AirOSBase: Attempt default v6 login URL
AirOSBase->>Device: POST default URL (form_data/json as configured)
alt Default login succeeds
Device-->>AirOSBase: 200 OK (session)
AirOSBase-->>Client: return success
else AirOSUrlNotFoundError or failure
note right of AirOSBase: Fall through to alternative path
end
end
rect rgb(240, 255, 240)
note right of AirOSBase: Attempt alternative v6 URL with form_data + ct_form
AirOSBase->>Device: POST alternative URL (form_data, ct_form)
alt Alternative login succeeds
Device-->>AirOSBase: 200 OK (session)
AirOSBase-->>Client: return success
else Failure
AirOSBase-->>Client: raise AirOSConnectionSetupError<br/>"Failed to login to default and alternate AirOS device urls"
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
- Coverage 91.27% 91.18% -0.09%
==========================================
Files 7 7
Lines 917 919 +2
==========================================
+ Hits 837 838 +1
- Misses 80 81 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md(1 hunks)airos/base.py(1 hunks)pyproject.toml(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airos/base.py (1)
airos/exceptions.py (1)
AirOSConnectionSetupError(8-9)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Run mypy
🔇 Additional comments (4)
pyproject.toml (1)
7-7: LGTM! Version bump is appropriate.The version bump from 0.5.4 to 0.5.5 appropriately reflects the login flow change documented in the CHANGELOG.
CHANGELOG.md (1)
5-9: LGTM! Changelog entry accurately documents the change.The changelog entry clearly describes the login flow change from json_data to form_data for v6 login.
airos/base.py (2)
281-284: LGTM! Error handling is appropriate.The error handling for the alternative URL correctly raises
AirOSConnectionSetupErrorwith a descriptive message indicating that both login attempts failed.
270-275: Verify authentication error fallback logic.The login flow currently stops on 401/403 from the default URL without trying the alternative endpoint. Confirm whether authentication failures should short-circuit the retry or if the alternative URL should still be attempted.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
airos/base.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airos/base.py (1)
airos/exceptions.py (1)
AirOSConnectionSetupError(8-9)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Run pytest using Python 3.13
🔇 Additional comments (1)
airos/base.py (1)
277-283: Past review addressed:ct_form=Trueis now present.The
ct_form=Trueflag has been correctly added to the alternative login request, ensuring consistency with other form_data usage in this file (lines 345, 361).



Summary by CodeRabbit
Bug Fixes
Documentation
Chores