【发布时间】:2010-09-10 16:39:30
【问题描述】:
我今天回到了通过 SSL 登录 Gmail 的旧脚本。该脚本在我上次运行它时运行良好(几个月前),但现在它立即死亡:
<urlopen error The read operation timed out>
如果我设置了超时时间(不管多长时间),它会更立即死亡:
<urlopen error The connect operation timed out>
后者可通过以下方式重现:
import socket
socket.setdefaulttimeout(30000)
sock = socket.socket()
sock.connect(('www.google.com', 443))
ssl = socket.ssl(sock)
返回:
socket.sslerror: The connect operation timed out
但我似乎无法重现前者,并且在多次浏览代码之后,我不知道是什么原因造成的。
【问题讨论】:
-
Python 是什么版本的?
-
请指定更多信息。我无法重现您的问题。
-
平台也会有所帮助。
标签: python api sockets ssl gmail