I want to see if I can access an online API, but for that, I need to have Internet access.
How can I see if there's a connection available and active using Python?
You can just try to download data, and if connection fail you will know that somethings with connection isn't fine.
Basically you can't check if computer is connected to internet. There can be many reasons for failure, like wrong DNS configuration, firewalls, NAT. So even if you make some tests, you can't have guaranteed that you will have connection with your API until you try.
How can I see if there's an available and active network connection in Python?