Created
August 18, 2012 19:59
-
-
Save tadeck/3389407 to your computer and use it in GitHub Desktop.
Python script for getting public IP address
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
This simple script fetches your IP as seen by web pages, and displays it. | |
Execute this script locally like that: | |
$ curl -s https://raw.github.com/gist/3389407/myip.py | python | |
""" | |
import urllib2 | |
print(urllib2.urlopen('http://ip.42.pl/raw').read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked for getting the public IP in my ec2 instace