I am trying to upload large CSV files onto GAE using a zip using XML & HTTP POST
Steps:
-
CSV is zipped & base64 encoded and sent to GAE via XML/HTTP POST
-
GAE – using minidom to parse XML
-
GAE – Base64 decode ZIP
-
GAE – Get CSV from Zip file.
I have tried using zipfile but can’t figure out how to create a zipfile object from the base 64decoded string
I get: TypeError: unbound method read() must be called with ZipFile instance as first argument (got str instance instead)
myZipFile = base64.decodestring(base64ZipFile)
objZip = zipfile.ZipFile(myZipFile,'r')
strCSV = zipfile.ZipFile.read(objZip,'list.csv')
As Rob mentioned,
ZipFilerequires a file-like object. You can useStringIOto provide a file-like interface to a string.For example: