tools/web: display socket timeout
This commit is contained in:
parent
8e0d746e4e
commit
3dbf8ed6ea
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user