Best way to check if there is internet?

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Tue Feb 22 03:31:42 EST 2022


A front end eng sent me this for how to check for the internet in JS

https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-online

But it also says:

"This attribute is inherently unreliable. A computer can be connected to a
network without having Internet access."

As discussed here but, it would have been nevertheless great to have this
tiny function instead of
nothing

Kind Regards,

Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog
<https://www.pythonkitchen.com>
github <https://github.com/Abdur-RahmaanJ>
Mauritius


On Mon, Feb 7, 2022 at 1:17 PM Abdur-Rahmaan Janhangeer <
arj.python at gmail.com> wrote:

> Greetings,
>
> Using the standard library or 3rd party libraries, what's the
> best way to check if there is internet? Checking if google.com
> is reachable is good but I wonder if there is a more native,
> protocol-oriented
> way of knowing?
>
> Even this URL recommends checking if a domain is up as a way to check for
> internet connectivity:
>
> https://www.ibm.com/support/pages/checking-network-connectivity-when-using-python-and-ibm-resilient-circuits
>
> Kind Regards,
>
> Abdur-Rahmaan Janhangeer
> about <https://compileralchemy.github.io/> | blog
> <https://www.pythonkitchen.com>
> github <https://github.com/Abdur-RahmaanJ>
> Mauritius
>


More information about the Python-list mailing list