感谢您的帮助提前。我感到困惑的是,相同的代码适用于Python 2.6,但不是2.5。下面是代码Python 2.5中的urllib或urllib2是否支持https?
import cgi, urllib, urlparse, urllib2
url='https://graph.facebook.com'
req=urllib2.Request(url=url)
p=urllib2.urlopen(req)
response = cgi.parse_qs(p.read())
,这里是我
Traceback (most recent call last):
File "t2.py", line 6, in <module>
p=urllib2.urlopen(req)
File "/home/userx/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/home/userx/lib/python2.5/urllib2.py", line 381, in open
response = self._open(req, data)
File "/home/userx/lib/python2.5/urllib2.py", line 404, in _open
'unknown_open', req)
File "/home/userx/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/home/userx/lib/python2.5/urllib2.py", line 1140, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: https>
再一次例外,欣赏的帮助。
必须是它! – oliodu 2010-05-20 16:07:24
我刚刚注意到最近的python总是定义这个函数,但是如果你打电话给它打印deprication警告,更好的检查可能是在CentOS/RedHat平台上导入_ssl' – 2014-02-12 08:45:48