使用带有登录https://selfserve.publicmobile.ca/Overview/的请求的python脚本时,我收到SSL“错误握手”错误
这是错误:
Traceback (most recent call last):
File "/home/pi/Documents/repos/private-repos/public-mobile-usage-scraping/pm_usage_scraping_to_db.py", line 55, in <module>
r = s.get(URL)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 526, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 513, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 623, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
SSLError: ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)
我知道解决方法是设置verify = False但会让我容易受到攻击,特别是因为我想在此发送用户名和密码。
根据我的研究,网站似乎缺少中间证书(参见https://www.ssllabs.com/ssltest/analyze.html?d=selfserve.publicmobile.ca)。
这是真的吗?在哪里/如何找到中间证书以将其添加到我的代码中?
或者,如果我使用我的帐户凭据向该网站发出非SSL请求有多糟糕,考虑到我只是从我的家庭网络那样做了?
我是python和web抓取的新手,并且只有SSL和Web安全的基础。非常感谢你的帮助!
答案 0 :(得分:1)
s.get(***,验证= False)你试试,cancal验证