with zipfile.GzipFile('/path/to/file') as Zip:
    for ZipMember in Zip.infolist():
        Zip.extract(ZipMember, path='/dir/where/to/extract', pwd=
            'your-password')
Bad magic number error with ZipFile module in Python