我正在尝试连接'https://myvodafone.vodafone.in/myvodafoneselfcare/jsp/commons/login.jsp'使用grab(版本0.4.8)。我得到以下错误。
ERROR:in_vodafone:17162:375: (<class 'grab.error.GrabNetworkError'>, GrabNetworkError(35, 'error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000)'), <traceback object at 0x10277cb00>)
DEBUG:in_vodafone:17162:Traceback (most recent call last):
File "in_vodafone.py", line 308, in download
g.go('http://www.vodafone.in/pages/myvodafone.aspx')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/grab-0.4.7-py2.7.egg/grab/base.py", line 306, in go
return self.request(url=url, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/grab-0.4.7-py2.7.egg/grab/base.py", line 384, in request
self.transport.request()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/grab-0.4.7-py2.7.egg/grab/transport/curl.py", line 345, in request
raise error.GrabNetworkError(ex[0], ex[1])
GrabNetworkError: [Errno 35] error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000)
我的脚本包含以下代码:
from grab import Grab
g = Grab()
g.setup(hammer_mode = True, hammer_timeouts = ((100, 200), (300, 400), (500, 600)))
g.go('https://myvodafone.vodafone.in/myvodafoneselfcare/jsp/commons/login.jsp')
我发现有一个urllib的解决方案可以在http://bugs.python.org/issue11220.如何将此解决方案与grab实用程序一起使用?
我找到了下面的解决方案,它运行良好。
from grab import Grab
import pycurl
g = Grab()
g.transport.curl.setopt(pycurl.SSLVERSION, 3)
g.setup(hammer_mode = True, hammer_timeouts = ((100, 200), (300, 400), (500, 600)))
g.go('https://myvodafone.vodafone.in/myvodafoneselfcare/jsp/commons/login.jsp')