urllib.open()中的超时 [英] timeout in urllib.open()
问题描述
大家好,
有没有办法修改电话的时间
urllib.open(...)
等待对方答复?有一个工具
自动检查网站列表
某些内容。该工具挂起当其中一个与b
联系的网站表现不佳并且从不时答案...
谢谢和问候
-stefan-
Hi all,
is there a way to modify the time a call of
urllib.open(...)
waits for an answer from the other side? Have a tool
which automatically checks a list of websites for
certain content. The tool "hangs" when one of the
contacted websites behaves badly and "never" answers...
Thanks and regards
-stefan-
推荐答案
Stefan Palme写道:
Stefan Palme wrote:
有没有办法修改
urllib的调用时间。打开(...)
等待另一方的回答?有一个工具
自动检查网站列表
某些内容。该工具挂起当其中一个与b
联系的网站表现不佳并且从不时答案...
is there a way to modify the time a call of
urllib.open(...)
waits for an answer from the other side? Have a tool
which automatically checks a list of websites for
certain content. The tool "hangs" when one of the
contacted websites behaves badly and "never" answers...
我相信这只能在全球范围内设定:
进口插座
socket.setdefaulttimeout(秒)
彼得
I believe this can only be set globally:
import socket
socket.setdefaulttimeout(seconds)
Peter
Uuuh这对我来说没有解决方案,因为
网站检查工具是在应用服务器中运行的非常大的
应用程序的一部分,所以
全局设置超时可能会打破很多其他的东西......
但是当有一个默认超时时(如
方法名称所示) - 是不是也有每插座超时
呢?
-stefan-
Uuuh this is no solution for me, because the
website-checking tool is part of a very very big
application running in an application server, so
globally setting the timeout may break a lot of
other things...
But when there is a "default timeout" (as indicated by
the method name) - isn''t there a "per-socket timeout"
too?
-stefan-
我相信这只能全局设置:
导入套接字
socket.setdefaulttimeout(秒)
Peter
I believe this can only be set globally:
import socket
socket.setdefaulttimeout(seconds)
Peter
Stefan Palme写道:
(top-posting undone)
[Peter]
Stefan Palme wrote:
(top-posting undone)
[Peter]
>我相信这只能全局设置:
导入套接字
socket.setdefaulttimeout(秒)
>I believe this can only be set globally:
import socket
socket.setdefaulttimeout(seconds)
[Stefan]
[Stefan]
Uuuh这对我来说没有解决方案,因为
网站检查工具是一个非常大的一部分
应用程序服务器中运行的应用程序,所以
全局设置超时可能会破坏很多
其他瘦身gs ...
但是当存在默认超时时(如
方法名称所示) - 是否还有每插槽超时
?
Uuuh this is no solution for me, because the
website-checking tool is part of a very very big
application running in an application server, so
globally setting the timeout may break a lot of
other things...
But when there is a "default timeout" (as indicated by
the method name) - isn''t there a "per-socket timeout"
too?
是的,但它并不容易获得......
也许你在这里找到一些想法:< >
彼得
Yes, but it isn''t as easily available...
Perhaps you find some ideas here:
http://mail.python.org/pipermail/pyt...ry/070897.html
Peter
>
这篇关于urllib.open()中的超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!