Skip to content

Instantly share code, notes, and snippets.

/parse_xml.py Secret

Created April 3, 2015 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7059517d40d3801be940 to your computer and use it in GitHub Desktop.
Save anonymous/7059517d40d3801be940 to your computer and use it in GitHub Desktop.
How would I request the XML URL and parse it for the <loc> nodes?
from xml.etree import ElementTree
import requests
response = requests.get("http://www.monkeysee.com/sitemap/0/5000/video_clip.xml")
tree = ElementTree.fromstring(response.content)
root = tree.getroot()
#> AttributeError: 'Element' object has no attribute 'getroot'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment