Xml.parsers.expat.ExpatError on parsing XML?

You forgot to call content on the response object. That's how you get the actual xml content = requests. Get(url = url).

Content rss = parse(content).getroot().

You forgot to call content on the response object. That's how you get the actual xml. Content = requests.

Get(url = url). Content rss = parse(content).getroot().

Thanks. Now I can at least print the content, however the parser has other problems :| But I think I can handle this soon. File "/usr/local/lib/python2.6/dist-packages/elementtree/ElementTree.Py", line 859, in parse tree.

Parse(source, parser) File "/usr/local/lib/python2.6/dist-packages/elementtree/ElementTree. Py", line 576, in parse source = open(source, "rb") IOError: Errno 2 No such file or directory: – Arun Jun 21 at 13:29 It looks like parse is expecting a file rather than a string. You should either look for a different method or do something like: import StringIO; rss = parse(StringIO.

StringIO(content)).getroot() – Ioan Alexandru Cucu Jun 21 at 13:37 Thanks a lot! Works perfectly on using BeautifulSoup instead of elementtree – Arun Jun 21 at 14:08.

First thing I'd advise would be to save a text file only with the content of the xml: just make sure there are no trailing characters at the end. Then check it the parsing works. If it does, then you know its a communication problem, and then have to figure how to 'clean' up what you are receiving.

Good luck!

This "pprint(requests. Get(url = url))" prints the HTML response code. – Arun Jun 21 at 13:19.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions