Skip to content

Instantly share code, notes, and snippets.

@hellais
Created May 21, 2013 13:04
Show Gist options
  • Save hellais/5619611 to your computer and use it in GitHub Desktop.
Save hellais/5619611 to your computer and use it in GitHub Desktop.
traceroute
import sys
import requests
import lxml.html
ip = sys.argv[1]
r = requests.get("http://lg.ring.nlnog.net/traceroute/lg01/ipv4?q=" + ip)
root = lxml.html.fromstring(r.text)
result = root.cssselect("pre")[0]
print lxml.html.fromstring(lxml.html.tostring(result).replace("<br>", "\n")).text_content()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment