我刚刚开始使用 python 来利用第三方 api 来改进我们公司的工作流程。我一直在使用的一个 API 是用于 citrix sharefile(一种安全的托管 FTP 服务器)。我使用 citrix 编写的模块作为示例来进行 api 调用,因此在我正在编写的内容和实际的 HTTP 请求之间至少有一层抽象。
当我发出身份验证请求以从我的笔记本电脑获取访问令牌时,这工作正常,但是当我尝试从 docker 容器(安装了 python 的 windows nano)内部做同样的事情时,我得到这个作为响应:
Traceback (most recent call last):
File "main.py", line 38, in <module>
sharefile = pysharefile.authenticate(hostname,sf_client_id,sf_client_secret,sf_username,sf_password)
File "C:\Python\lib\site-packages\pysharefile\pysharefile.py", line 42, in authenticate
http.request('POST', uri_path, urllib.parse.urlencode(params), headers=headers)
File "C:\Python\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Python\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Python\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Python\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\Python\lib\http\client.py", line 964, in send
self.connect()
File "C:\Python\lib\http\client.py", line 1400, in connect
server_hostname=server_hostname)
File "C:\Python\lib\ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "C:\Python\lib\ssl.py", line 808, in __init__
self.do_handshake()
File "C:\Python\lib\ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "C:\Python\lib\ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
根据我的阅读,这可能是因为容器无法访问我计算机上的证书,但如果是这样,我将如何在容器中安装 SSL 证书?
谢谢,奥斯汀