简体   繁体   English

Python httplib2“ httplib2.SSLHandshakeError”

[英]Python httplib2 “httplib2.SSLHandshakeError”

I have this piece of code that tries to get the page content from a given url. 我有这段代码试图从给定的URL获取页面内容。

import httplib2

start_url = "https://www.somesite.com"
http = httplib2.Http(disable_ssl_certificate_validation=True)
status, response = http.request(start_url)

However, when I run it, I get this error: 但是,当我运行它时,出现此错误:

Traceback (most recent call last):   File "C:\Documents and Settings\DD\Desktop\crawler.py", line 15, in <module>
    resp, content = h.request(start_url, "GET")   File "C:\Python27\lib\site-packages\httplib2-0.9-py2.7.egg\httplib2\__init__.py", line 1593, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)   File "C:\Python27\lib\site-packages\httplib2-0.9-py2.7.egg\httplib2\__init__.py", line 1335, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)   File "C:\Python27\lib\site-packages\httplib2-0.9-py2.7.egg\httplib2\__init__.py", line 1257, in _conn_request
    conn.connect()   File "C:\Python27\lib\site-packages\httplib2-0.9-py2.7.egg\httplib2\__init__.py", line 1044, in connect
    raise SSLHandshakeError(e) httplib2.SSLHandshakeError: [Errno 1] _ssl.c:510: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac

As you may have seen, I tried to disable the ssl validation but with no succsess. 如您所见,我尝试禁用ssl验证,但没有成功。 Any Help? 有帮助吗? Thanks! 谢谢!

SSL3_GET_RECORD:decryption failed or bad record mac SSL3_GET_RECORD:解密失败或Mac记录错误

This has nothing to do with SSL validation. 这与SSL验证无关。 It might be that the server simply does not talk SSL or that there are other SSL related problems, but validation is not one of them at this stage of communication. 可能是服务器根本不讲SSL或存在其他与SSL相关的问题,但在此通信阶段验证不是其中之一。

If you provide the real URL or a full packet capture (file or at cloudshark.org) one might analyze the information in more detail. 如果您提供真实的URL或完整的数据包捕获(文件或在cloudshark.org上提供),则可能会更详细地分析信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM