timeout for urllib2.urlopen() in pre Python 2.6 versions

前端 未结 6 528
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 03:34

The urllib2 documentation says that timeout parameter was added in Python 2.6. Unfortunately my code base has been running on Python 2.5 and 2.4 platforms.

6条回答
  •  天命终不由人
    2020-12-29 04:10

    I think your best choice is to patch (or deploy an local version of) your urllib2 with the change from the 2.6 maintenance branch

    The file should be in /usr/lib/python2.4/urllib2.py (on linux and 2.4)

提交回复
热议问题