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
Post a Comment