From: AceVest Date: Sat, 17 Feb 2018 10:52:42 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=968971ed2d802c80e09a6f80237c5ea61e5a6f66;p=acecode.git ... --- 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