All pastes #490245 Raw Edit

Get External Ip

public python v1 · immutable
·published 2007-05-15 22:26 UTC
rendered paste body
from httplib import HTTPConnectionfrom xml.dom.ext.reader.Sax import FromXmlStreamconn = HTTPConnection('www.showmyip.com')conn.request('GET', '/xml/')doc = FromXmlStream(conn.getresponse())print doc.getElementsByTagName('ip')[0].firstChild.dataconn.close()