python - 在进行 API 调用时出现 SSL 错误,主要是 TLS 版本不匹配
问题描述
我正在尝试调用 API,作为回报,我收到了SSL
错误,这很可能是因为TLS
版本不匹配。请指导我需要做什么才能使其工作。
` 导入 ssl
from twilio.rest import Client
accountSID = 'xxxxxx'
authToken = 'xxxxxxx
twilioCli = Client(accountSID, authToken)
myTwilioNumber = '+14955551234'
myCellPhone = 'xxxxxxxx'
message = twilioCli.messages.create(body='Mr.Ankit - you are doing great.', from_=myTwilioNumber, to=myCellPhone)
print(message.sid)`
Python代码生成错误:
“HTTPSConnectionPool(host='api.twilio.com', port=443): 最大重试次数超出 url: /2010-04-01/Accounts/AC1f7769b1600b53ae66ebd6a7c4cd1b92/Messages.json (由 SSLError(SSLError("bad handshake: Error ([('SSL 例程', 'tls_process_server_certificate', '证书验证失败')])")))"
SSL
1.1版
Python
版本是 3.7
解决方案
推荐阅读
- python - 我的程序中一个特别重要的变量不会改变
- if-statement - Smartsheet 上 IF ELSE 的公式帮助
- unit-testing - xunit .net core 2.1 在VS2017中运行的基本单元测试失败并超时
- python - 从元组转换时在字符串中删除空格时出错
- java - 我的单元测试用例因断言错误而失败
- c++ - 如何在 C++ 中简单地正确验证?
- jasmine - 茉莉模拟 window.location.reload(true);
- android - 安卓作业调度器。我可以每 15 秒安排一次工作吗
- ruby - [passenger + apache + ruby]HTTP PUT 文件因传输编码器失败:passengerbufferupload 关闭时分块标头
- java - 在 ArrayList 中获取 ArrayList 值 - Java