Created
October 10, 2016 23:40
-
-
Save iordic/3e54863fd4a99778a489b740747ece5b 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
import urllib | |
def extract_public_ip(): | |
sock = urllib.urlopen('http://checkip.dyndns.com/') | |
public_ip = sock.read() | |
sock.close() | |
public_ip = public_ip.split(': ')[-1] | |
public_ip = public_ip.split('</body>')[0] | |
return public_ip | |
print 'Your public IP is: ' + extract_public_ip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment