From 968971ed2d802c80e09a6f80237c5ea61e5a6f66 Mon Sep 17 00:00:00 2001 From: AceVest Date: Sat, 17 Feb 2018 18:52:42 +0800 Subject: [PATCH] ... --- RaspberryPi/lanip/GetLanIp.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/RaspberryPi/lanip/GetLanIp.py b/RaspberryPi/lanip/GetLanIp.py index 4559fd8..d9c754e 100755 --- a/RaspberryPi/lanip/GetLanIp.py +++ b/RaspberryPi/lanip/GetLanIp.py @@ -55,13 +55,18 @@ def SendMail(title, content) : if __name__ == "__main__" : - lanip = { 'wlan0':'NULL', 'eth0':'NULL', 'lo':'NULL' } - for k, v in lanip.items() : - try : - lanip[k] = get_ip_address(k) - except : - continue while True : + lanip = { 'wlan0':'NULL', 'eth0':'NULL', 'lo':'NULL' } + for k, v in lanip.items() : + try : + lanip[k] = get_ip_address(k) + except : + continue + + if lanip['wlan0'] == 'NULL' : + time.sleep(1) + continue + try : SendMail("LanIp", str(lanip)) break -- 2.44.0