tools/web: display socket timeout

This commit is contained in:
nemunaire 2017-07-22 10:49:38 +02:00
parent 2938287869
commit 0d52fff64a

View File

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