Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Python how to get your public ip address
SUBMITTED BY:
alemotta
DATE:
April 8, 2017, 8:05 p.m.
FORMAT:
Text only
SIZE:
329 Bytes
Raw
Download
Tweet
HITS:
531
Go to comments
Report
Python how to get your public ip address
import urllib
import re
print "we will try to open this url, in order to get IP Address"
url = "http://checkip.dyndns.org"
print url
request = urllib.urlopen(url).read()
theIP = re.findall(r"d{1,3}.d{1,3}.d{1,3}.d{1,3}", request)
print "your IP Address is: ", theIP
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus