1

Hi I'm using python with the azure-sdk to download files from a storage blob. The following code is what I use.

BLOB_SERVICE = BlockBlobService(account_name=AZURE_BLOB_SERVICE_ACCOUNT_NAME, account_key=AZURE_BLOB_SERVICE_ACCOUNT_KEY)

cloud_globals.BLOB_SERVICE.get_blob_to_path(
            guid,
            name,
            path,
        )

The download works but Azure or the SDK decompresses my gzipped files on the fly when the files are fetched. I need the files to be gzipped and I would prefer to download the files as they are on the storage. Is there any way to turn off this behaviour?

Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102
  • It seams Azure sdk is not responsible in itself for the deflation it could be that it's requirement requests 2.9.2 does it automatically. I will have a look at this – Pablo Jomer Oct 10 '18 at 09:42
  • Hi, try to focus on the content type and content encoding settings? https://stackoverflow.com/questions/46612595/python-azure-uploaded-file-content-type-changed-to-application-octet-stream – Jay Gong Oct 10 '18 at 10:03
  • @JayGong It seems that request indeed does automatic gzipp decompression. Why should I focus on the encoding settings? – Pablo Jomer Oct 10 '18 at 10:05

1 Answers1

1

In my experience, your issue is due to your blob properties. You could check it on the portal and need to set the Content_Encoding = NULL.

enter image description here

I tested your code and the gz file could be downloaded normally.

If I set the Content_Encoding = gzip which is corresponding to my file foramt, the gz file will be decompressed when the file is fetched as same as you. You could refer to this doc.

halfer
  • 19,824
  • 17
  • 99
  • 186
Jay Gong
  • 23,163
  • 2
  • 27
  • 32