Created
October 11, 2015 22:23
-
-
Save miawgogo/bfdee6aeabfff6cc87ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Ioan Loosley, CC0 | |
import urllib2 | |
f = open('lastip', "r+") | |
pubipsite = urllib2.urlopen("http://ipecho.net/plain") | |
pubip = pubipsite.read() | |
lastip = f.read() | |
if pubip != lastip: | |
#put code here | |
print "Ip changed to", pubip | |
f.seek(0) | |
f.write(pubip) | |
else: | |
print "no change" | |
f.seek(0) | |
f.write(pubip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment