Skip to content

Commit 73f1c9b

Browse files
committed
Accept REST cookies from IP hosts with unsafe CookieJar
1 parent 43b0f45 commit 73f1c9b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sagemcom_api/client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ClientOSError,
1818
ClientSession,
1919
ClientTimeout,
20+
CookieJar,
2021
ContentTypeError,
2122
ServerDisconnectedError,
2223
TCPConnector,
@@ -113,6 +114,7 @@ def __init__(
113114
else ClientSession(
114115
headers={"User-Agent": f"{DEFAULT_USER_AGENT}"},
115116
timeout=ClientTimeout(DEFAULT_TIMEOUT),
117+
cookie_jar=CookieJar(unsafe=True),
116118
connector=TCPConnector(
117119
verify_ssl=verify_ssl if verify_ssl is not None else True
118120
),
@@ -784,7 +786,11 @@ async def get_hosts(self, only_active: bool | None = False) -> list[Device]:
784786
data = await self.__rest_request("GET", endpoint)
785787
devices = parser(data)
786788
break
787-
except (UnknownException, UnsupportedHostException) as exception:
789+
except (
790+
UnknownException,
791+
UnsupportedHostException,
792+
AuthenticationException,
793+
) as exception:
788794
rest_errors.append(exception)
789795
else:
790796
if rest_errors:

0 commit comments

Comments
 (0)