ChinemeremChigbo / discord-mutual-friends-and-servers

Provides lists of Discord server members that are your friends, members you have mutual friends with, and members you have mutual servers with.
19 stars 0 forks source link

SSL Errors? #5

Closed ryantheleach closed 1 month ago

ryantheleach commented 3 months ago

Newly installed windows evaluation vm, following your instructions, I'm getting an SSL related error.

C:\Users\User\Desktop\New folder\discord-mutual-friends-and-servers>py main.py
WARNING:discord.client:PyNaCl is not installed, voice will NOT be supported.
[2024-07-07 11:57:00] [INFO    ] discord.client: Logging in using static token.
INFO:discord.client:Logging in using static token.
[2024-07-07 11:57:01] [INFO    ] discord.http: Found user agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36, build number 307392.
INFO:discord.http:Found user agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36, build number 307392.
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 1025, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1149, in create_connection
    transport, protocol = await self._create_connection_transport(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1182, in _create_connection_transport
    await waiter
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\sslproto.py", line 578, in _on_handshake_complete
    raise handshake_exc
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\sslproto.py", line 560, in _do_handshake
    self._sslobj.do_handshake()
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 917, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\New folder\discord-mutual-friends-and-servers\main.py", line 478, in <module>
    client.run(token)
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 1106, in run
    asyncio.run(runner())
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 1095, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 1025, in start
    await self.login(token)
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 867, in login
    data = await state.http.static_login(token.strip())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\http.py", line 1058, in static_login
    data = await self.get_me()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\http.py", line 799, in request
    async with self.__session.request(method, url, **kwargs) as response:
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 1257, in _create_direct_connection
    raise last_exc
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 1226, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiohttp\connector.py", line 1027, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')]

C:\Users\User\Desktop\New folder\discord-mutual-friends-and-servers>

I've tried setting environment variables in the .env file to ignore certificates to no avail.

Would appreciate any tips you might have.

ChinemeremChigbo commented 2 months ago

Hey Ryan! My friend seemed to have the same error and fixed it by following this StackOverflow article: https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate. Just find the folder where Python is installed and run the Install Certificates.command script. Please let me know if that works!

ChinemeremChigbo commented 1 month ago

Closing for now, please re-open if you are still encountering this issue!