How to programmatically check if PC has internet connectivity using Python and/or Ruby? -


i have scripts in both python , ruby run days @ time , rely on internet go domains , collect data. there way implement network connectivity check script pause/retry iterations of loop if there no connectivity , restart when there connectivity?

there may more elegant solution, i'd this:

require 'open-uri'  def internet_connectivity?   open('http://google.com')   true rescue => ex   false end 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -