I got error while using SSL on Qpython (android)

117 views Asked by At

I have project, where I need control of values, if value is there it send my e-mail. On Win10 work great, but on my old tablet Nexus2013 second generation not workinkg. There I have app: QPython OL and when I run my code, show this error message:

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)',))

Use this code:

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()

Where in my code I can put code with DEFAULT_CIPHERS?

0

There are 0 answers