Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e42ae8 commit dcdadfeCopy full SHA for dcdadfe
1 file changed
Lib/urllib/request.py
@@ -2229,7 +2229,10 @@ def thishost():
2229
"""Return the IP addresses of the current host."""
2230
global _thishost
2231
if _thishost is None:
2232
- _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
+ try:
2233
+ _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
2234
+ except socket.gaierror:
2235
+ _thishost = tuple(socket.gethostbyname_ex('localhost')[2])
2236
return _thishost
2237
2238
_ftperrors = None
0 commit comments