Skip to content

Commit 1d724a6

Browse files
committed
Add form logging (temporarily) + change authenticated status
1 parent dbedf00 commit 1d724a6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

airos/base.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ async def _request_json(
336336
self.api_version,
337337
dict(response.headers),
338338
)
339+
_LOGGER.error(
340+
"TESTv%s - Response history: %s", self.api_version, response.history
341+
)
339342

340343
# v6 responds with a 302 redirect and empty body
341344
if not url.startswith(self._login_urls["v6_login"]):
@@ -344,6 +347,13 @@ async def _request_json(
344347

345348
response_text = await response.text()
346349
_LOGGER.error("Successfully fetched %s from %s", response_text, url)
350+
if not response_text.strip():
351+
_LOGGER.error(
352+
"TESTv%s - Empty response from %s despite %s",
353+
self.api_version,
354+
url,
355+
response.status,
356+
)
347357

348358
# If this is the login request, we need to store the new auth data
349359
if url in self._login_urls.values():
@@ -421,6 +431,12 @@ async def login(self) -> None:
421431
v6_simple_multipart_form_data.add_field("username", self.username)
422432
v6_simple_multipart_form_data.add_field("password", self.password)
423433

434+
_LOGGER.debug(
435+
"TESTv%s !!!REDACT THIS!!!! Form payload: %s",
436+
self.api_version,
437+
v6_simple_multipart_form_data(),
438+
)
439+
424440
login_headers = {
425441
"Referer": self._login_urls["v6_login"],
426442
}
@@ -438,7 +454,9 @@ async def login(self) -> None:
438454
self._login_urls["v6_login"],
439455
headers=login_headers,
440456
form_data=v6_simple_multipart_form_data,
441-
authenticated=True,
457+
ct_form=False,
458+
ct_json=False,
459+
authenticated=False,
442460
allow_redirects=True,
443461
)
444462
except (AirOSUrlNotFoundError, AirOSConnectionSetupError) as err:

0 commit comments

Comments
 (0)