Hi, i need a simple python code which would trigger a command if there is an internet connection; if there isn't, sleep for some time and check again until there is.
I found few examples, but they're all rather difficult to grasp and being new to python, I can't get them working. If there really is no simple solution for this in Python, i'll try and go with the other ones. Thanks!
Jump to Post
I would just try to open any sure to be up url in try statement inside while True loop. In else statement of try I would put activity for internet open. Most likely a function call.
All 8 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.