【发布时间】:2017-12-06 21:36:49
【问题描述】:
我正在尝试使用几种不同的实现从 Flask Admin 将文件上传到 S3。在这两种情况下,我都会收到 SSL 错误。我尝试了一些我发现的东西,例如将其添加到配置中:
S3_USE_HTTPS = False
我还更新了我在另一个线程上看到推荐的 certifi 包。我无法解决这个错误。知道我为什么会得到这个吗?
以下错误消息:
> File
> "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 1071, in make_request
> retry_handler=retry_handler) File "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 1030, in _mexe
> raise ex File "/Users/kevin/dev/allstarrma/flask-env/lib/python3.6/site-packages/boto/connection.py",
> line 943, in _mexe
> request.body, request.headers) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1239, in request
> self._send_request(method, url, body, headers, encode_chunked) File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1285, in _send_request
> self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1234, in endheaders
> self._send_output(message_body, encode_chunked=encode_chunked) File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1026, in _send_output
> self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 964, in send
> self.connect() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
> line 1400, in connect
> server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 407, in wrap_socket
> _context=self, _session=session) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 814, in __init__
> self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 1068, in do_handshake
> self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
> line 689, in do_handshake
> self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
【问题讨论】:
-
注意这不会解决根本原因,但是您可以使用 PYTHONHTTPSVERIFY=0 调用 python 脚本,因此从命令行它看起来像
PYTHONHTTPSVERIFY=0 /path/to/script.py。 Python ssl 不应该再抱怨认证了。 -
部署到heroku的时候呢?
标签: python amazon-web-services ssl flask boto3