I was unable to extractfile while streaming the network tar file, I did something like this:
from backports.lzma import LZMAFile import tarfile some_streamed_tar = LZMAFile(requests.get('http://some.com/some.tar.xz').content) with tarfile.open(fileobj=some_streamed_tar) as tf: tarfileobj.extractall(path="/tmp", members=None)
And read them:
for fn in os.listdir("/tmp"): with open(os.path.join(t, fn)) as f: print(f.read())
python 2.7.13
source share