Closed boyzhujian closed 8 years ago
Please try one of the following ways:
ret = self.session.get( 'https://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&class=login&tt=%s&logintype=dialogLogin&callback=0' % int(time.time())).text.replace('\'', '\"')
to
ret = self.session.get( 'https://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&class=login&tt=%s&logintype=dialogLogin&callback=0' % int(time.time()), verify=False).text.replace('\'', '\"')
关闭ssl证书校验可以解决,也方便用mitmproxy调试接口.
@xm0625 也方便被攻击。 正确的姿势是放弃使用 Python <= 2.7.8。
Thank you all
when first deploy on remote server, encounter this,I never change anything and I'am sure password is ok. request version is requests (2.8.1) requests-toolbelt (0.4.0)
super(PCS, self).init(username, password, api_template, captcha_func=captcha_callback) File "/home/wwwroot/yun.4moviescheduling.com/api.py", line 135, in init self._initiate() File "/home/wwwroot/yun.4moviescheduling.com/api.py", line 183, in _initiate self.user['token'] = self._get_token() File "/home/wwwroot/yun.4moviescheduling.com/api.py", line 210, in _get_token 'https://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&class=login&tt=%s&logintype=dialogLogin&callback=0' % int(time.time())).text.replace('\'', '\"') File "/usr/local/lib/python2.7/dist-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 480, in get return self.request('GET', url, _kwargs) File "/usr/local/lib/python2.7/dist-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 468, in request resp = self.send(prep, _send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests-2.8.1-py2.7.egg/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests-2.8.1-py2.7.egg/requests/adapters.py", line 447, in send raise SSLError(e, request=request) requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed