_ssl.c:997 SSLError 智能表 API

问题描述 投票:0回答:0

大约六个月前,我编写了一些代码来访问 Smartsheet API,当我回来时,这些代码不再起作用。例如,

import smartsheet

api_key = "ABCD1234"

smartsheet_client = smartsheet.Smartsheet(api_key)
smartsheet_client.errors_as_exceptions(True)
print("Hello World\n")

sheets = smartsheet_client.Sheets.list_sheets(include_all=True).data
print(sheets)

现在将输出:

Hello World

Traceback (most recent call last): File "C:\Users\...\test_smartsheet\virtenv\lib\site-packages\urllib3\connectionpool.py", line 468, in _make_request    self._validate_conn(conn) ... File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

...

The above exception was the direct cause of the following exception:

During handling of the above exception, another exception occurred:

The above exception was the direct cause of the following exception:

...

File "C:\Users\...\test_smartsheet\virtenv\lib\site-packages\smartsheet\smartsheet.py", line 335, in _request raise HttpError(rex, "SSL handshake error, old CA bundle or old OpenSSL?") from rex smartsheet.exceptions.HttpError: (SSLError(MaxRetryError("HTTPSConnectionPool(host='api.smartsheet.com', port=443): Max retries exceeded with url: /2.0/sheets?includeAll=True (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:997)')))")), 'SSL handshake error, old CA bundle or old OpenSSL?')

我尝试更改请求和证书的版本,并使用“api-smartsheet-com-chain”更新 cacert.pem 文件,即 100-PKROOTCA290-CA PEM(链)文件(... est_smartsheet irtenv\Lib\站点包

python ssl ssl-certificate smartsheet-api sslexception
© www.soinside.com 2019 - 2024. All rights reserved.