I'm using a webservice to get a certain xml file from it. It works fine with urllib2 I get the xml as fileobject. So I want to know what would be the fastest way to store that somewhere in memory or not even store just parse it.
I tried iterparse on that object and it takes too long unless I save it first in file, then iterparse takes much less time.
So now I'm using this code to store it locally first and then do with that file what I want, and I would like to know is there a fastest way of doing it, fastest way of storing files.
url = "webservice"
s = urllib2.urlopen(url)
file = open("export.xml",'wb+')
for line in s:
file.write(line)
Thanks