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

Commit 6b9257e

Browse files
claytonjnludeeus
authored andcommitted
Fix excluding IPs (#54)
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.
1 parent 20cd255 commit 6b9257e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

custom_components/authenticated/sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def load_authentications(authfile, exclude):
325325
if ValidateIP(token["last_used_ip"]) in ip_network(
326326
excludeaddress, False
327327
):
328-
continue
328+
raise Exception('IP in excluded address configuration')
329329
if token.get("last_used_at") is None:
330330
continue
331331
if token["last_used_ip"] in tokens_cleaned:
@@ -350,7 +350,7 @@ def load_authentications(authfile, exclude):
350350

351351

352352
class AuthenticatedData:
353-
"""Data class for autenticated values."""
353+
"""Data class for authenticated values."""
354354

355355
def __init__(self, ipaddr, attributes):
356356
"""Initialize."""
@@ -499,7 +499,7 @@ def update_geo_info(self):
499499
elif data.get("status", "success") == "fail":
500500
raise AuthenticatedBaseException(
501501
"[{}] - {}".format(
502-
self.ipaddr, data.get("message", "Unkown error.")
502+
self.ipaddr, data.get("message", "Unknown error.")
503503
)
504504
)
505505

0 commit comments

Comments
 (0)