omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Pythonista 3 error on iPadOS: cannot connect to host discord.com:443 ssl=True

    Pythonista
    3
    12
    4044
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Penguin Master
      Penguin Master last edited by

      I'm coding a Discord.py bot in python and I'm trying to move to pythonista but getting this error and i haven't found anyone else with this error on pythonista:

      ssl.CertificateError: hostname 'IP-ADDRESS' doesn't match either of 'ssl764977.cloudflaressl.com', '*.discord.com', 'discord.com'
      

      please help me with this as i spent $15 on this and would really like to be able to use it. Thank you!

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @Penguin Master last edited by

        @Penguin-Master said:

        I'm coding a Discord.py bot in python and I'm trying to move to pythonista but getting this error and i haven't found anyone else with this error on pythonista:

        ssl.CertificateError: hostname 'IP-ADDRESS' doesn't match either of 'ssl764977.cloudflaressl.com', '*.discord.com', 'discord.com'
        

        please help me with this as i spent $15 on this and would really like to be able to use it. Thank you!

        Looks like this is an issue with discord's certificate -- they are using an untrusted root certificate.

        https://github.com/Rapptz/discord.py/issues/4159

        On iOS, I believe you can down a cert offline, email it to yourself, and install as a trusted root.

        Alternatively, you can disable SSL cert checks if you modify http.py :

        async def get_from_cdn(self, url):
                async with self.__session.get(url) as resp:
        

        Change to

        async def get_from_cdn(self, url):
                async with self.__session.get(url, ssl=False) as resp:
        

        Dangerous, but I guess you are just risking trusting a fake discord server, it is not like you are sharing your bank info via discord.

        There may be ways to go to discord.com in safari and down the certificate directly, but I'm not sure.

        Penguin Master 1 Reply Last reply Reply Quote 0
        • Penguin Master
          Penguin Master @JonB last edited by Penguin Master

          @JonB thanks for the quick reply, I'll try that
          Edit: didn't work. do you have any other ideas?

          1 Reply Last reply Reply Quote 0
          • Penguin Master
            Penguin Master last edited by

            OK, I looked at the issue you sent, and that's a different error. This one is hostname doesn't match, and the other one is certificate expired... 🤔

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              It is still a certificate error. -- did you try the change in http.py? You will need to force quit pythonista and try again

              Penguin Master 1 Reply Last reply Reply Quote 0
              • Penguin Master
                Penguin Master @JonB last edited by

                @JonB yes I tried, but nothing happened

                1 Reply Last reply Reply Quote 0
                • JonB
                  JonB last edited by

                  Can you post your full traceback?

                  Penguin Master 2 Replies Last reply Reply Quote 0
                  • Penguin Master
                    Penguin Master @JonB last edited by

                    @JonB Sure

                    1 Reply Last reply Reply Quote 0
                    • Penguin Master
                      Penguin Master @JonB last edited by

                      @JonB here https://mystb.in/CasualSectionsDealt.rust

                      1 Reply Last reply Reply Quote 0
                      • Unique_Name
                        Unique_Name last edited by

                        Going back to version 1.5.0 fixed it for me, seems like pythonista just doesn’t like 1.5.1 for some reason

                        1 Reply Last reply Reply Quote 0
                        • JonB
                          JonB last edited by

                          You could also try (before importing discord -- need to restart pythonista then try this)

                          import ssl
                          ssl.match_hostname = lambda cert, hostname: True
                          

                          For some reason, ssl.match_hostname is being called with 'IP-ADDRESS' instead of an actual hostname. I'm not sure where that is coming from exactly, I guess the underlying _sslobj from OpenSSL. Pythonista uses an old OpenSSL version iirc, so this could explain it maybe.

                          Penguin Master 1 Reply Last reply Reply Quote 2
                          • Penguin Master
                            Penguin Master @JonB last edited by

                            @JonB I can't thank you enough, I got Pythonista 3 mainly for this and now it works!!!

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB Forums | Contributors