Catch failed hostname resolution (Fixes Tautulli/Tautulli-Issues#68)
This commit is contained in:
@@ -1072,7 +1072,10 @@ def get_plexpy_url(hostname=None):
|
|||||||
s.connect(('<broadcast>', 0))
|
s.connect(('<broadcast>', 0))
|
||||||
hostname = s.getsockname()[0]
|
hostname = s.getsockname()[0]
|
||||||
except socket.error:
|
except socket.error:
|
||||||
hostname = socket.gethostbyname(socket.gethostname())
|
try:
|
||||||
|
hostname = socket.gethostbyname(socket.gethostname())
|
||||||
|
except socket.gaierror:
|
||||||
|
pass
|
||||||
|
|
||||||
if not hostname:
|
if not hostname:
|
||||||
hostname = 'localhost'
|
hostname = 'localhost'
|
||||||
|
Reference in New Issue
Block a user