An application creates a zip file and stores it to Google Storage. I am working on the web server side which is responsible for grabbing the zip file extract the contents etc. The web service is written in Python App Engine. So far I have set the credentials and by following the tutorials I am able to list buckets contents. Although I am able to read the metadata and file information I am not able to get the contents to zip file module. Following this guide I have ended up in that spot which is not working:
uri = boto.storage_uri(BUCKET_NAME, GOOGLE_STORAGE)
objs = uri.get_bucket()
files = []
for obj in objs:
object_contents = StringIO.StringIO()
if obj.get_key():
obj.get_file(object_contents)
my_zip = zipfile.ZipFile(object_contents)
object_contents.close()
files.append(my_zip)
print len(files)
I am getting: BadZipfile: File is not a zip file
我如何适当阅读内容?