Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Fix excluding IPs #54

Merged
merged 1 commit into from
Jan 26, 2020
Merged
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
6 changes: 3 additions & 3 deletions custom_components/authenticated/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def load_authentications(authfile, exclude):
if ValidateIP(token["last_used_ip"]) in ip_network(
excludeaddress, False
):
continue
raise Exception('IP in excluded address configuration')
if token.get("last_used_at") is None:
continue
if token["last_used_ip"] in tokens_cleaned:
Expand All @@ -350,7 +350,7 @@ def load_authentications(authfile, exclude):


class AuthenticatedData:
"""Data class for autenticated values."""
"""Data class for authenticated values."""

def __init__(self, ipaddr, attributes):
"""Initialize."""
Expand Down Expand Up @@ -499,7 +499,7 @@ def update_geo_info(self):
elif data.get("status", "success") == "fail":
raise AuthenticatedBaseException(
"[{}] - {}".format(
self.ipaddr, data.get("message", "Unkown error.")
self.ipaddr, data.get("message", "Unknown error.")
)
)

Expand Down