This question already has answers here:
Python AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

(21 个回答)


3年前关闭。




我在使用 twilio 时遇到 SSL 错误。有人有什么建议吗?

错误:



代码:
import random
from twilio.rest import Client

TWILIO_ACCOUNT_SID = "asdfasdfsdfsdf"
TWILIO_AUTH_TOKEN  = "asdfasdfasdfasf"
TWILIO_NUMBER = "+5555555"


def send_text(body, target_phone_number):
    client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
    message = client.messages.create(body=body, from_=TWILIO_NUMBER, to=target_phone_number)

send_text(blah, blah)

最佳答案

根据 this github ticket ,问题可以通过升级到 pyOpenSSL>=16.2.0 来解决

尝试:

pip install pyOpenSSL -U

关于python - 属性错误 : 'module' object has no attribute 'SSL_ST_INIT' ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48482641/

10-12 22:06