姬長信(Redy)

python – 请求库:在cx_Freeze之后缺少SSL握手…


我正在使用请求库在python 3.3中构建一个应用程序.
当我尝试获取具有SSL连接的URL时,我想使用verify = true验证它.
这在运行我的python脚本时非常有效.

当我冻结相同的脚本时,它会崩溃.它错过了一些东西,我真的无法弄清楚如何将它集成到我的冻结应用程序中.

我收到以下错误(这也会触发其他错误,但我不在这里发布):

Traceback (most recent call last):
File "C:/Python33-32/lib/site-packages/requests/packages/urllib3/connectionpool.py", line 422, in urlopen
body=body, headers=headers)
File "C:/Python33-32/lib/site-packages/requests/packages/urllib3/connectionpool.py", line 274, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:/Python33-32/lib/http/client.py", line 1049, in request
self._send_request(method, url, body, headers)
File "C:/Python33-32/lib/http/client.py", line 1087, in _send_request
self.endheaders(body)
File "C:/Python33-32/lib/http/client.py", line 1045, in endheaders
self._send_output(message_body)
File "C:/Python33-32/lib/http/client.py", line 890, in _send_output
self.send(msg)
File "C:/Python33-32/lib/http/client.py", line 828, in send
self.connect()
File "C:/Python33-32/lib/site-packages/requests/packages/urllib3/connectionpool.py", line 105, in connect
ssl_version=self.ssl_version)
File "C:/Python33-32/lib/site-packages/requests/packages/urllib3/util.py", line 281, in ssl_wrap_socket
context.load_verify_locations(ca_certs)
FileNotFoundError: [Errno 2] No such file or directory 

似乎缺少ca_certs.在请求库中有一个名为cacert.pem的文件,但我不知道这是否是丢失的文件以及如何导入它,因为它似乎没有集成到我的最终冻结包中.