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

How can I fetch data from a web server in an android application? -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -

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