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

Commit

Permalink
Fix excluding IPs (#54)
Browse files Browse the repository at this point in the history
Now that everything's in a try block continue doesn't work. Raising an exception was the easiest way to fix the functionality however removing the for loop from the try block and using a separate try block inside the for loop is also an option. Also, noticed a couple typos.
  • Loading branch information
claytonjn authored and ludeeus committed Jan 26, 2020
1 parent 20cd255 commit 6b9257e
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 6b9257e

Please sign in to comment.