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
-
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!
-
@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.
-
@JonB thanks for the quick reply, I'll try that
Edit: didn't work. do you have any other ideas? -
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... 🤔
-
It is still a certificate error. -- did you try the change in http.py? You will need to force quit pythonista and try again
-
@JonB yes I tried, but nothing happened
-
Can you post your full traceback?
-
@JonB Sure
-
-
Going back to version 1.5.0 fixed it for me, seems like pythonista just doesn’t like 1.5.1 for some reason
-
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.
-
@JonB I can't thank you enough, I got Pythonista 3 mainly for this and now it works!!!