Script completely rewrited 

Now uses the requests lib and find the ip using a dns query to myip.opendns.com