title: Python: Get zip file from Google Drive API and load its content
body: <p>I have a <code>zipfile</code> on my <code>Google Drive</code>. In that <code>zipfile</code> is a <code>XML file</code>, which I want to parse, extract a specific information and save this information on my local computer (or wherever).</p>
  
  <p>My goal is to use Python &amp; Google Drive API (with help of <a href="https://pythonhosted.org/PyDrive/" rel="nofollow noreferrer">PyDrive</a>) to achieve this. The workflow could be as follows:</p>
  
  <ol>
  <li>Connect to my Google Drive via Google Drive API (PyDrive)</li>
  <li>Get my zipfile id </li>
  <li>Load my zipfile to memory</li>
  <li>Unzip, obtain the XML file</li>
  <li>Parse the XML, extract the desired information</li>
  <li>Save it as a csv on my local computer</li>
  </ol>
  
  <p>Right now, I am able to do steps 1,2,4,5,6. But I dont know how to load the zipfile into memory without writing it on my local HDD first. </p>
  
  <p>Following PyDrive code will obtain the zipfile and place it on my local HDD, which is not exactly what I want.</p>
  
  <pre><code>toUnzip = drive.CreateFile({'id':'MY_FILE_ID'})
  toUnzip.GetContentFile('zipstuff.zip')
  </code></pre>
  
  <hr>
  
  <p>I guess one solution could be as follows: </p>
  
  <p>I could read the zipfile as a string with some encoding: </p>
  
  <pre><code>toUnzip = drive.CreateFile({'id':'MY_FILE_ID'})
  zipAsString = toUnzip.GetContentString(encoding='??')
  </code></pre>
  
  <p>and then, I could somehow (no idea how, perhaps <code>StringIO</code> could be useful) read this string with Python zipfile library. Is this solution even possible? Is there a better way? </p>