我正在使用 requests 库的 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 。requests 库中有一个名为 cacert.pem 的文件,但我不知道这是否是丢失的文件以及如何导入它,因为它似乎没有集成到我最终的冻结包中。