def GetExternalIp():
  h = httplib2.Http(tempfile.gettempdir(), timeout=10)
  url = 'http://whatismyip.akamai.com'
  resp, content = h.request(url, 'GET')
  if resp.status == 200:
    return content
  for provider in (UltraDNSAuth(), MyResolverInfo()):
    answer = provider.GetClientIp()
    if answer:
      return answer
Helper method to get external IP from anyone who cares.
dataset/ETHPy150Open catap/namebench/libnamebench/providers.py/GetExternalIp