微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Qpython (android) 上使用 SSL 时出错

如何解决在 Qpython (android) 上使用 SSL 时出错

我有项目,我需要在那里控制价值,如果有价值,它会发送我的电子邮件。在 Win10 上运行良好,但在我的旧平板电脑 Nexus2013 第二代上无法正常工作。我有应用程序:QPython OL,当我运行我的代码时,显示错误消息:

Google.auth.exceptions.TransportError: HTTPSConnectionPool(host='oauth2.googleapis.com',port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLError(1,'[SSL: NO_CIPHERS_AVAILABLE] no ciphers available (_ssl.c:841)',))

使用此代码

import smtplib
import gspread
import ssl
from oauth2client.service_account import ServiceAccountCredentials

scope = [
'https://www.googleapis.com/auth/spreadsheets','https://www.googleapis.com/auth/drive'
]

#komuniakce s Excelem od Googlu
data = ServiceAccountCredentials.from_json_keyfile_name("/storage.../data.json",scope)
client = gspread.authorize(data)

#test vyhledání
sheet3 = client.open("name_sheet").worksheet('DATA')
values = sheet3.findall("1")
for r in values:
    # User configuration
    sender_email = 'email'
    receiver_email = 'email'
    password = 'pass'

    # Email text
    email_body = '''
    ''' + ("Text...: " + ((sheet3.row_values(r.row)[1]))) +  '''
    '''

    server = smtplib.SMTP('smtp.gmail.com',587)
    # Encrypts the email
    context = ssl.create_default_context()
    server.starttls(context=context)
    # We log in into our Google account
    server.login(sender_email,password)
    # Sending email from sender,to receiver with the email body
    server.sendmail(sender_email,receiver_email,email_body.encode('utf-8'))

    print('E-mail zaslán.')
    print('Kontrola dokončena.')
    server.quit()

我可以在代码中的哪个位置放置带有 DEFAULT_CIPHERS 的代码

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。