在 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 (将#修改为@)