I have an internal DNS. It is configured in my router settings so all devices automatically use it. It works everywhere on my Mac, except in python (No route to host). I tried requests module and httpx.
import requests
requests.get("https://test.mynetwork.de")
leads to:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='test.mynetwork.de', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x105cdba70>: Failed to establish a new connection: [Errno 65] No route to host'))
This DOES work on both Windows and Linux machines in my network.
On my Mac, outside of python it resolves correctly:
curl https://test.mynetwork.de
It also works in the browser and with other commands like nslookup or dig.
I also added the DNS explicitly in the Network setting and verified that it's in /etc/resolv.conf
Nothing works. And the weird thing is that it used to work on my old Mac without any configuration there.
Does anyone have an idea why?
I found the solution after trying it on another Mac user, where it worked. For some reason, both my IDE and terminal lacked the permission to connect to my local network.. When I turned this on in the Mac settings, it worked.