Best way to check if there is internet?

Avi Gross avigross at verizon.net
Wed Feb 9 20:11:40 EST 2022


Actually, you may want a dynamic page. Pages may sometimes be delivered from some cache along the way perhaps within your own company firewall if someone else recently accessed them.
Consider a page that returns the current time or like the following asks for an arithmetical calculation to add 5 and 6
https://search.yahoo.com/search?fr=mcafee&type=E211US1249G0&p=%3D5%2B6
Not a great example, and it may not work for you, but there likely is a site that can exist that accepts a request for some formatted calculation that you can specify dynamically. You can compare a date/time returned to being accurate within some seconds and asking for n*m can obviously be validated.
Of course, once such a ploy is well known, it can be intercepted and sent proper results and still fool you into assuming you had full internet access. 
So a site that you can send to and receive back using a cryptographic method might be better.



-----Original Message-----
From: Abdur-Rahmaan Janhangeer <arj.python at gmail.com>
To: Python <python-list at python.org>
Sent: Wed, Feb 9, 2022 12:24 pm
Subject: Re: Best way to check if there is internet?

> This won't work if you're behind a captive portal: every URL you
try to get will return successfully, but the content will be
the captive portal page.

Yes agree a pretty common scenario if you are moving around ...
The solution is to test against a webpage you know the content
will always be the same. Thanks for pointing out!

Kind Regards,

Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog
<https://www.pythonkitchen.com>
github <https://github.com/Abdur-RahmaanJ>
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list