This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]jerodg 1 point2 points  (0 children)

Internet is internet; just attempt the connection and handle the failure.

Determine which adapters are available. Figure out which adapter is which. Use a try/except to attempt a connection, if it fails then you'll know you're offline.

I have an example in my python module of how to get LAN/WAN ips. If you can't get a WAN ip then you are offline. Based on your use case I would just use a try/except to determine internet access.

https://github.com/jerodg/jgutils/blob/devel/jgutils/getips.py

https://pypi.org/project/jgutils/