Allow get local ip to work without internet (#8855)

This commit is contained in:
Paulus Schoutsen 2017-08-06 09:15:17 -07:00 committed by GitHub
parent c49cce7243
commit ac9c1235bb

View File

@ -99,7 +99,10 @@ def get_local_ip():
return sock.getsockname()[0]
except socket.error:
try:
return socket.gethostbyname(socket.gethostname())
except socket.gaierror:
return '127.0.0.1'
finally:
sock.close()