0

I'm building a kivy android application but when i try to execute it on android it stops working and I get this:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>

This is the main.py

from kivymd.app import MDApp
from kivy.lang import Builder

class YoutubeDownloaderApp(MDApp):

    def build(self):

        self.title = "Youtube Downloader"
        self.theme_cls.primary_palette = "Red"
        self.theme_cls.primary_hue = "400"
        self.theme_cls.theme_style = "Dark"
        return Builder.load_file("youtubedownloader.kv")

    def download_video(self, query):

        self.root.ids["mdlab1"].text = "Sto scaricando il video..."
        yt = YouTube(query)
        title = yt.title
        ys = yt.streams.get_highest_resolution()
        lnomefile = str.lower(title)
        nomefile = lnomefile.replace(" ", "")
        self.root.ids["mdlab1"].text = "Sto scaricando il video..."
        ys.download(filename=nomefile)
        self.root.ids["mdlab1"].text = "Video scaricato!"

    def convert_button(self):

        self.root.ids["mdlab1"].text = "Sto scaricando il video..."
        query = self.root.ids["mdtext1"].text
        self.download_video(query)


YoutubeDownloaderApp().run()

I don't know what's the problem, it's the first time I try to work with kivy.

ClaudiaR
  • 3,108
  • 2
  • 13
  • 27

1 Answers1

1

You should add this in main.py

import certifi
import os
# Here's all the magic !
os.environ['SSL_CERT_FILE'] = certifi.where()
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Abdul
  • 11
  • 2
  • 1
    you should add this in main.py import certifi import os # Here's all the magic ! os.environ['SSL_CERT_FILE'] = certifi.where() – Abdul Jul 08 '21 at 11:24