I want to know my internet provider (external) IP address (broadband or something else) with Python.
There are multiple machines are connected to that network. I tried in different way's but I got only the local and public IP my machine. How do I find my external IP address through Python?
Thanks in advance.
Use this script :
import urllib, json data = json.loads(urllib.urlopen("http://ip.jsontest.com/").read()) print data["ip"]
Without json :
import urllib, re data = re.search('"([0-9.]*)"', urllib.urlopen("http://ip.jsontest.com/").read()).group(1) print data