Break from IPLOCATION method loop if one method produces non-null result

This commit is contained in:
Gregory Danielson 2020-11-15 11:02:12 -06:00
parent 34313eb162
commit c349dc2f17
No known key found for this signature in database
GPG key ID: 88D4EF22F6C14CA7

View file

@ -196,6 +196,8 @@ def get_location(ip_addr):
location = ipinfo(ip_addr)
else:
print("ERROR: invalid iplocation method specified: %s" % method)
if location is not None:
break
if location is not None and all(location):
ipcachewrite(ip_addr, location)