V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ithelloworld
V2EX  ›  程序员

连接服务器时的socket问题

  •  
  •   ithelloworld · Feb 27, 2013 · 3054 views
    This topic created in 4806 days ago, the information mentioned may be changed or developed.
    写个脚本计算服务器端数据,用的是python的httplib包(http://docs.python.org/2/library/httplib.html)。
    有时数据突然出现socket问题,走到一半不走了,花了很长时间等了半天,再从头来挺郁闷。
    有什么好的解决办法?
    2 replies    1970-01-01 08:00:00 +08:00
    phuslu
        1
    phuslu  
       Feb 27, 2013
    用 urllib2, 支持 urllib2.urlopen 支持 timeout 参数。
    另外还有更强大的第三方库 requests
    ithelloworld
        2
    ithelloworld  
    OP
       Feb 27, 2013
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   827 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:50 · PVG 04:50 · LAX 13:50 · JFK 16:50
    ♥ Do have faith in what you're doing.