parse xml document (on url) in python



I am trying to parse xml document (URL) using requests,


facing following error:



ValueError: Unicode strings with encoding declaration are not supported


here is my code:



import requests
from lxml import etree
from lxml.etree import fromstring

req = requests.request('GET', "http://ift.tt/1GsOdjg")

a = req.text
b = etree.fromstring(a)


how can i get this xml parsed. Thanks in advance for help


No comments:

Post a Comment