Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sagemcom_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async def get_value_by_xpath(self, xpath: str, options: dict | None = None) -> d
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def get_values_by_xpaths(self, xpaths: dict[str, str], options: dict | None = None) -> dict:
Expand Down Expand Up @@ -445,7 +445,7 @@ async def set_value_by_xpath(self, xpath: str, value: str, options: dict | None
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def set_values_by_xpaths(self, xpaths: dict[str, str], options: dict | None = None) -> dict:
Expand Down Expand Up @@ -476,7 +476,7 @@ async def set_values_by_xpaths(self, xpaths: dict[str, str], options: dict | Non
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def get_device_info(self) -> DeviceInfo:
Expand Down Expand Up @@ -507,7 +507,7 @@ async def get_device_info(self) -> DeviceInfo:
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def get_hosts(self, only_active: bool | None = False) -> list[Device]:
Expand All @@ -529,7 +529,7 @@ async def get_hosts(self, only_active: bool | None = False) -> list[Device]:
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def get_port_mappings(self) -> list[PortMapping]:
Expand All @@ -547,7 +547,7 @@ async def get_port_mappings(self) -> list[PortMapping]:
LoginTimeoutException,
InvalidSessionException,
),
max_tries=1,
max_tries=2,
on_backoff=retry_login,
)
async def get_logs(self) -> str:
Expand Down
9 changes: 7 additions & 2 deletions sagemcom_api/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ class AuthenticationException(UnauthorizedException):
"""Raised when authentication is not correct."""


class InvalidSessionException(UnauthorizedException):
"""Raised when session is invalid."""
class InvalidSessionException(BaseSagemcomException):
"""Raised when session is invalid.

This is a transient error that occurs when the router invalidates the
session (e.g., due to a concurrent login). It should not be treated as
a permanent authorization failure.
"""


class LoginRetryErrorException(BaseSagemcomException):
Expand Down