Skip to content

Instantly share code, notes, and snippets.

@mdeous
Created November 2, 2012 11:23
Show Gist options
  • Select an option

  • Save mdeous/4000333 to your computer and use it in GitHub Desktop.

Select an option

Save mdeous/4000333 to your computer and use it in GitHub Desktop.
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import requests
from lxml.etree import HTMLParser, parse
data = requests.get('http://pastebin.com/archive')
parser = HTMLParser(encoding='utf8')
tree = parse(StringIO(data.content), parser)
root = tree.getroot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment