diff --git a/CHANGELOG.md b/CHANGELOG.md index f2df1c9..0284e22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [0.5.5] - 2025-10-05 + +### Changed + +- Change login from json_data to form_data for v6 login + ## [0.5.4] - 2025-10-01 ### Added diff --git a/airos/base.py b/airos/base.py index c1ae6c4..506917a 100644 --- a/airos/base.py +++ b/airos/base.py @@ -268,16 +268,23 @@ async def login(self) -> None: "POST", self._login_urls["default"], json_data=payload ) except AirOSUrlNotFoundError: - try: - await self._request_json( - "POST", self._login_urls["v6_alternative"], json_data=payload - ) - except AirOSConnectionSetupError as err: - raise AirOSConnectionSetupError( - "Failed to login to default and alternate AirOS device urls" - ) from err + pass # Try next URL except AirOSConnectionSetupError as err: raise AirOSConnectionSetupError("Failed to login to AirOS device") from err + else: + return + + try: # Alternative URL + await self._request_json( + "POST", + self._login_urls["v6_alternative"], + form_data=payload, + ct_form=True, + ) + except AirOSConnectionSetupError as err: + raise AirOSConnectionSetupError( + "Failed to login to default and alternate AirOS device urls" + ) from err async def status(self) -> AirOSDataModel: """Retrieve status from the device.""" diff --git a/pyproject.toml b/pyproject.toml index 281e7fa..b77a7d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "airos" -version = "0.5.4" +version = "0.5.5" license = "MIT" description = "Ubiquiti airOS module(s) for Python 3." readme = "README.md"