Skip to content

Instantly share code, notes, and snippets.

@gklka
Created June 2, 2015 14:45
Show Gist options
  • Select an option

  • Save gklka/4a37e89b4ef1b5f4657b to your computer and use it in GitHub Desktop.

Select an option

Save gklka/4a37e89b4ef1b5f4657b to your computer and use it in GitHub Desktop.
IP change detection and display in OS X Notification
from pync import Notifier
import urllib2
import time
ip = None
while True:
response = urllib2.urlopen('http://ip1.dynupdate.no-ip.com')
new_ip = response.read()
# print new_ip
if new_ip != ip:
Notifier.notify("IP changed from %s to %s" % (ip, new_ip))
ip = new_ip
time.sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment