Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CERTIFICATE_VERIFY_FAILED #61

Closed
panthersuper opened this issue Sep 24, 2020 · 2 comments
Closed

CERTIFICATE_VERIFY_FAILED #61

panthersuper opened this issue Sep 24, 2020 · 2 comments

Comments

@panthersuper
Copy link

panthersuper commented Sep 24, 2020

Hi, I tried to login the client with the following code:

import sys
sys.path.append("./coc.py")

import coc
import logging
logging.basicConfig(level=logging.DEBUG)

client = coc.login('email@email.com', 'pass.')
print(client)

And the login never succeeds, log is shown here:

DEBUG:asyncio:Using selector: KqueueSelector
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 820, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 846, in _create_connection_transport
    yield from waiter
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 505, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 201, in feed_ssldata
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)

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

Traceback (most recent call last):
  File "main.py", line 9, in <module>
    client = coc.login('email', 'pass')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/coc/login.py", line 54, in login
    instance.loop.run_until_complete(instance.login(email, password))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/coc/client.py", line 167, in login
    await self.http.get_keys()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/coc/http.py", line 149, in get_keys
    response_dict, session = await self.login_to_site(self.email, self.password)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/coc/http.py", line 378, in login_to_site
    "https://developer.clashofclans.com/api/login", json=login_data, headers=headers,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 941, in _wrap_create_connection
    raise ClientConnectorSSLError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host developer.clashofclans.com:443 ssl:default [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)]
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fc13122f240>

Any idea what the reason is? Thanks so much!

@wpmjones
Copy link
Collaborator

Panther - This is actually a discord.py error. Check out this comment from Rapptz which has a fix for you.

Rapptz/discord.py#423 (comment)

Basically navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command.

@panthersuper
Copy link
Author

Panther - This is actually a discord.py error. Check out this comment from Rapptz which has a fix for you.

Rapptz/discord.py#423 (comment)

Basically navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command.

Problem solved, thanks, you are awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants