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

gregdan3/master
Gregory Danielson 4 years ago
parent 34313eb162
commit c349dc2f17
No known key found for this signature in database
GPG Key ID: 88D4EF22F6C14CA7

@ -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)

Loading…
Cancel
Save