tools/web: display socket timeout

This commit is contained in:
nemunaire 2017-07-22 10:49:38 +02:00 committed by nemunaire
parent 8e0d746e4e
commit 3dbf8ed6ea

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from urllib.parse import urljoin, urlparse, urlsplit, urlunsplit
import socket
from nemubot.exception import IMException
@ -123,6 +124,8 @@ def getURLContent(url, body=None, timeout=7, header=None):
o.path,
body,
header)
except socket.timeout as e:
raise IMException(e)
except OSError as e:
raise IMException(e.strerror)