On 2022-02-09 at 11:15:34 +0400, Abdur-Rahmaan Janhangeer <arj.pyt...@gmail.com> wrote:
> I think for me having the internet means ability to request urls You can always ask. The real question is what will the response be? ;-) This entire exercise is a race condition, just like checking for that a file exists before deleting it, or that it doesn't exist before creating it. If you "have internet" when you check, what assurance do you have that you will still "have internet" when you actually want to use it? And if you don't "have internet" when you check, when do you check again? I think someone said it way upthread: don't check, just do whatever you came to do, and it will work or it will fail (presumably, your program can tell the difference, regardless of a past snapshot of being able to retrieve data from an arbitrary URL). EAFP, anyone? -- https://mail.python.org/mailman/listinfo/python-list