I think I better understand the issue, when i previously ran the hole example I ran it in the machine not inside the docker and it ran, running it from the docker itself:
import asyncio
import json
import aiohttp
from hole import Hole
async def main():
"""Get the data from a *hole instance."""
async with aiohttp.ClientSession() as session:
data = Hole('pi.DOMAIN.NAME', loop, session, tls=True, verify_tls=False)
await data.get_versions()
print(json.dumps(data.data, indent=4, sort_keys=True))
await data.get_data()
# Get the raw data
print(json.dumps(data.data, indent=4, sort_keys=True))
print("Status:", data.status)
print("Domains being blocked:", data.domains_being_blocked)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
got me the following response:
Can not load data from *hole: pi.DOMAIN.NAME
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 924, in _wrap_create_connection
await self._loop.create_connection(*args, **kwargs))
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 981, in create_connection
ssl_handshake_timeout=ssl_handshake_timeout)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1009, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 530, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 189, in feed_ssldata
self._sslobj.do_handshake()
File "/usr/local/lib/python3.7/ssl.py", line 774, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/hole/__init__.py", line 55, in get_versions
params=params)
File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 476, in _request
timeout=real_timeout
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 522, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 854, in _create_connection
req, traces, timeout)
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 992, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 974, in _create_direct_connection
req=req, client_error=client_error)
File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 927, in _wrap_create_connection
req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host pi.DOMAIN.NAME:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "<stdin>", line 5, in main
File "/usr/local/lib/python3.7/site-packages/hole/__init__.py", line 65, in get_versions
raise exceptions.HoleConnectionError(msg)
hole.exceptions.HoleConnectionError: Can not load data from *hole: pi.DOMAIN.NAME
after looking at that issue within Alpine, i got to the following fix:
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
the only problem is, I don’t know what is missing in HA code to fix it