Skip to content

Commit

Permalink
Fix optional uptime (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Jan 6, 2023
1 parent 294d96c commit 61f71db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sfrbox_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ def _empty_to_none(v: str) -> Optional[str]:
class DslInfo:
"""Informations sur le lien ADSL."""

# validators
_empty_to_none = validator("uptime", pre=True, allow_reuse=True)(_empty_to_none)

linemode: str
"""Mode du lien.
(firmware >= 2.1.2)"""
uptime: int
uptime: Optional[int]
"""Nombre de seconde depuis la montée du lien.
(firmware >= 2.1.2)"""
Expand Down Expand Up @@ -131,13 +134,15 @@ class WanInfo:
"""Informations génériques sur la connexion internet."""

# validators
_empty_to_none = validator("uptime6", pre=True, allow_reuse=True)(_empty_to_none)
_empty_to_none = validator("uptime", "uptime6", pre=True, allow_reuse=True)(
_empty_to_none
)

status: str
"""Status de la connexion internet.
= (up|down)"""
uptime: int
uptime: Optional[int]
"""Temps de connexion internet v4 ou v6 (suivant les cas)"""
ip_addr: str
"""Adresse IPv4 internet.
Expand Down

0 comments on commit 61f71db

Please sign in to comment.