-
Notifications
You must be signed in to change notification settings - Fork 1
Add login.cgi as login_url for wider v6 support #100
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
WalkthroughReplaces the single login URL with a map of login URLs and adds fallback logic to try a v6 alternate; surfaces 404 responses as a new AirOSUrlNotFoundError; updates auth storage/connected logic to consider multiple login URLs; bumps package to 0.5.4 and adds CHANGELOG entry dated 2025-10-01. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant A as AirOS Client
participant D as Device
Note over A: Login: try default → fallback to v6_alternative on 404
C->>A: login(credentials)
rect rgba(200,230,200,0.12)
A->>D: POST /api/auth/login (default)
alt 200 OK
D-->>A: 200 + session/token
A-->>C: success (store auth for default URL)
else 404 Not Found
D-->>A: 404
A->>D: POST /api/auth/login (v6_alternative)
alt 200 OK
D-->>A: 200 + session/token
A-->>C: success (store auth for v6_alternative)
else error
D-->>A: error (4xx/5xx)
A-->>C: raise AirOSUrlNotFoundError or underlying error
end
else other error
D-->>A: error
A-->>C: raise corresponding exception
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (1)
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 |
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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
airos/base.py (1)
310-317: Content-Type/body mismatch in update_check(force).You send JSON while forcing
application/x-www-form-urlencoded. Use JSON consistently (matches the non-force branch), or switch toform_data. Suggest JSON for both.if force: return await self._request_json( "POST", self._update_check_url, json_data={"force": True}, authenticated=True, - ct_form=True, + ct_json=True, )
🧹 Nitpick comments (2)
airos/exceptions.py (1)
44-46: Docstring capitalization.Use “URL” for consistency with other docstrings.
-class AirOSUrlNotFoundError(AirOSException): - """Raised when url not available for device.""" +class AirOSUrlNotFoundError(AirOSException): + """Raised when URL not available for device."""airos/base.py (1)
74-79: Avoid future URL-membership slips with a helper.Centralize the check to prevent repeats of the dict-membership bug.
# Mostly 8.x API endpoints, login/status are the same in 6.x self._login_urls = { "default": f"{self.base_url}/api/auth", "v6_alternative": f"{self.base_url}/login.cgi", } + self._login_url_set = frozenset(self._login_urls.values()) + + def _is_login_url(self, url: str) -> bool: + return url in self._login_url_setThen replace
url in self._login_urls.values()withself._is_login_url(url)in this file.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CHANGELOG.md(1 hunks)airos/base.py(6 hunks)airos/exceptions.py(1 hunks)pyproject.toml(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airos/base.py (1)
airos/exceptions.py (2)
AirOSUrlNotFoundError(44-45)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 (1)
pyproject.toml (1)
7-7: Align release version with CHANGELOG entry.CHANGLELOG lists 0.5.4 while pyproject is 0.5.4a1. Either change CHANGELOG to 0.5.4a1 or bump this to 0.5.4 before publishing to avoid confusion for users and tooling.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
==========================================
- Coverage 91.85% 91.27% -0.59%
==========================================
Files 7 7
Lines 909 917 +8
==========================================
+ Hits 835 837 +2
- Misses 74 80 +6 ☔ 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 (2)
airos/base.py(6 hunks)pyproject.toml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- airos/base.py
|



Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores