首页 > 解决方案 > 在进行 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', '证书验证失败')])")))"

SSL1.1版

Python版本是 3.7

标签: pythonssltwilio

解决方案


推荐阅读