title: Python, opening TarFile from data in a variable
body: <p>I get a tar file in the body of a http post request and I want to extract the contents without first writing the tar file to disc. The file used to be a zip file and i could do</p>
  
  <pre><code>zip = zipfile.ZipFile(StringIO(request.content.read()))
  zip.extractall(some_path)
  </code></pre>
  
  <p>How do i do the same thing using tarfile.TarFile?</p>
  
  <p>I tried </p>
  
  <pre><code>tar = tarfile.open(fileobj = StringIO(self.request.content.read()))
  </code></pre>
  
  <p>but got the error message: </p>
  
  <pre><code>file could not be opened successfully
  </code></pre>